home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2018 July / PCgo 07-2018 CD-ROM Germany.iso / nw.pak / Unnamed File 004757.txt < prev    next >
Encoding:
Text File  |  2015-07-29  |  1.5 MB  |  10,842 lines

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1. var allDescriptors=[{"experiment":"promiseTracker","extensions":[{"className":"WebInspector.PromisePane","order":"30","type":"drawer-view","name":"promises","title":"Promises"}],"name":"promises","dependencies":["components"],"scripts":[]},{"name":"heap_snapshot_worker","scripts":[]},{"dependencies":["source_frame","extensions"],"extensions":[{"className":"WebInspector.SourcesPanelFactory","order":2,"type":"@WebInspector.PanelFactory","name":"sources","title":"Sources"},{"className":"WebInspector.AdvancedSearchView","order":"1","type":"drawer-view","name":"sources.search","title":"Search"},{"className":"WebInspector.SourcesPanel.ContextMenuProvider","contextTypes":["WebInspector.UISourceCode","WebInspector.RemoteObject","WebInspector.NetworkRequest"],"type":"@WebInspector.ContextMenu.Provider"},{"className":"WebInspector.SourcesPanel.TogglePauseActionDelegate","contextTypes":["WebInspector.SourcesPanel","WebInspector.ShortcutRegistry.ForwardedShortcut"],"bindings":[{"platform":"windows,linux","shortcut":"F8 Ctrl+\\"},{"platform":"mac","shortcut":"F8 Meta+\\"}],"type":"@WebInspector.ActionDelegate","actionId":"debugger.toggle-pause"},{"className":"WebInspector.AdvancedSearchView.ToggleDrawerViewActionDelegate","bindings":[{"platform":"mac","shortcut":"Meta+Alt+F"},{"platform":"windows,linux","shortcut":"Ctrl+Shift+F"}],"type":"@WebInspector.ActionDelegate","actionId":"sources.search.toggle"},{"className":"WebInspector.SourcesPanel.UILocationRevealer","contextTypes":["WebInspector.UILocation"],"type":"@WebInspector.Revealer"},{"className":"WebInspector.SourcesPanel.UISourceCodeRevealer","contextTypes":["WebInspector.UISourceCode"],"type":"@WebInspector.Revealer"},{"className":"WebInspector.SourcesPanel.DebuggerPausedDetailsRevealer","contextTypes":["WebInspector.DebuggerPausedDetails"],"type":"@WebInspector.Revealer"},{"className":"WebInspector.InplaceFormatterEditorAction","type":"@WebInspector.SourcesView.EditorAction"},{"className":"WebInspector.ScriptFormatterEditorAction","type":"@WebInspector.SourcesView.EditorAction"},{"className":"WebInspector.SourcesNavigatorView","order":1,"type":"navigator-view","name":"sources","title":"Sources"},{"className":"WebInspector.ContentScriptsNavigatorView","order":2,"type":"navigator-view","name":"contentScripts","title":"Content scripts"},{"className":"WebInspector.SnippetsNavigatorView","order":3,"type":"navigator-view","name":"snippets","title":"Snippets"},{"className":"WebInspector.SourcesPanel.ShowGoToSourceDialogActionDelegate","bindings":[{"platform":"mac","shortcut":"Meta+O Meta+P"},{"platform":"windows,linux","shortcut":"Ctrl+O Ctrl+P"}],"type":"@WebInspector.ActionDelegate","actionId":"sources.go-to-source"},{"className":"WebInspector.SourcesView.SwitchFileActionDelegate","contextTypes":["WebInspector.SourcesView"],"bindings":[{"shortcut":"Alt+O"}],"type":"@WebInspector.ActionDelegate","actionId":"sources.switch-file"},{"className":"WebInspector.SourcesPanel.DisableJavaScriptSettingDelegate","type":"ui-setting","settingName":"javaScriptDisabled","settingType":"custom"},{"section":"Sources","settingType":"checkbox","type":"ui-setting","settingName":"searchInContentScripts","title":"Search in content scripts"},{"section":"Sources","settingType":"checkbox","type":"ui-setting","settingName":"jsSourceMapsEnabled","title":"Enable JavaScript source maps"},{"section":"Sources","settingType":"checkbox","type":"ui-setting","settingName":"textEditorAutoDetectIndent","title":"Detect indentation"},{"section":"Sources","settingType":"checkbox","type":"ui-setting","settingName":"textEditorAutocompletion","title":"Autocompletion"},{"section":"Sources","settingType":"checkbox","type":"ui-setting","settingName":"textEditorBracketMatching","title":"Bracket matching"},{"section":"Sources","settingType":"checkbox","type":"ui-setting","settingName":"showWhitespacesInEditor","title":"Show whitespace characters"},{"section":"Sources","settingType":"checkbox","type":"ui-setting","settingName":"cssSourceMapsEnabled","title":"Enable CSS source maps"},{"parentSettingName":"cssSourceMapsEnabled","settingType":"checkbox","type":"ui-setting","settingName":"cssReloadEnabled","title":"Auto-reload generated CSS"}],"name":"sources","scripts":[],"skip_compilation":["jsdifflib.js"]},{"dependencies":["sdk","platform","workspace"],"name":"bindings","scripts":[]},{"dependencies":["components","extensions"],"extensions":[{"className":"WebInspector.AuditsPanelFactory","order":6,"type":"@WebInspector.PanelFactory","name":"audits","title":"Audits"}],"name":"audits","scripts":[]},{"dependencies":["timeline"],"extensions":[{"className":"WebInspector.LayersPanelFactory","order":7,"type":"@WebInspector.PanelFactory","name":"layers","title":"Layers"},{"className":"WebInspector.LayersPanel.LayerTreeRevealer","contextTypes":["WebInspector.DeferredLayerTree"],"type":"@WebInspector.Revealer"}],"experiment":"layersPanel","scripts":[],"name":"layers"},{"dependencies":["components"],"extensions":[{"className":"WebInspector.ConsolePanelFactory","order":20,"type":"@WebInspector.PanelFactory","name":"console","title":"Console"},{"className":"WebInspector.ConsolePanel.WrapperView","order":"0","type":"drawer-view","name":"console","title":"Console"},{"className":"WebInspector.ConsolePanel.ConsoleRevealer","contextTypes":["WebInspector.Console"],"type":"@WebInspector.Revealer"},{"className":"WebInspector.ConsoleView.ShowConsoleActionDelegate","bindings":[{"shortcut":"Ctrl+`"}],"type":"@WebInspector.ActionDelegate","actionId":"console.show"},{"section":"Console","settingType":"checkbox","type":"ui-setting","settingName":"hideNetworkMessages","title":"Hide network messages"},{"section":"Console","settingType":"checkbox","type":"ui-setting","settingName":"monitoringXHREnabled","title":"Log XMLHttpRequests"},{"section":"Console","settingType":"checkbox","type":"ui-setting","settingName":"preserveConsoleLog","title":"Preserve log upon navigation"},{"section":"Console","settingType":"checkbox","type":"ui-setting","settingName":"consoleTimestampsEnabled","title":"Show timestamps"}],"name":"console","scripts":[]},{"dependencies":["source_frame"],"extensions":[{"className":"WebInspector.NetworkPanelFactory","order":1,"type":"@WebInspector.PanelFactory","name":"network","title":"Network"},{"className":"WebInspector.NetworkPanel.ContextMenuProvider","contextTypes":["WebInspector.NetworkRequest","WebInspector.Resource","WebInspector.UISourceCode"],"type":"@WebInspector.ContextMenu.Provider"},{"className":"WebInspector.NetworkPanel.RequestRevealer","contextTypes":["WebInspector.NetworkRequest"],"type":"@WebInspector.Revealer"},{"title":"Show primary load waterfall","section":"Network","experiment":"showPrimaryLoadWaterfallInNetworkTimeline","settingName":"networkShowPrimaryLoadWaterfall","settingType":"checkbox","type":"ui-setting"},{"section":"Network","settingType":"checkbox","type":"ui-setting","settingName":"networkColorCodeResourceTypes","title":"Color-code resource types"}],"name":"network","scripts":[]},{"dependencies":[],"name":"platform","scripts":[]},{"dependencies":["components"],"extensions":[{"className":"WebInspector.CodeMirrorUtils","type":"@WebInspector.InplaceEditor"},{"className":"WebInspector.CodeMirrorUtils.TokenizerFactory","type":"@WebInspector.TokenizerFactory"},{"title":"Default indentation:","section":"Sources","settingName":"textEditorIndent","settingType":"select","type":"ui-setting","options":[["2 spaces","  "],["4 spaces","    "],["8 spaces","        "],["Tab character","\t"]]}],"name":"source_frame","scripts":[],"skip_compilation":["../cm/codemirror.js","../cm/css.js","../cm/javascript.js","../cm/xml.js","../cm/htmlmixed.js","../cm/matchbrackets.js","../cm/closebrackets.js","../cm/markselection.js","../cm/comment.js","../cm/overlay.js","../cm/htmlembedded.js","../cm/clike.js","../cm/coffeescript.js","../cm/php.js","../cm/python.js","../cm/shell.js"]},{"dependencies":["extensions","host","platform","screencast","sdk","toolbox"],"extensions":[{"className":"WebInspector.HandlerRegistry.ContextMenuProvider","contextTypes":["WebInspector.UISourceCode","WebInspector.Resource","WebInspector.NetworkRequest","Node"],"type":"@WebInspector.ContextMenu.Provider"},{"className":"WebInspector.Main.ReloadActionDelegate","bindings":[{"platform":"windows,linux","shortcut":"F5 Ctrl+R"},{"platform":"mac","shortcut":"Meta+R"}],"type":"@WebInspector.ActionDelegate","actionId":"main.reload"},{"className":"WebInspector.Main.HardReloadActionDelegate","bindings":[{"platform":"windows,linux","shortcut":"Shift+F5 Ctrl+F5 Ctrl+Shift+F5 Shift+Ctrl+R"},{"platform":"mac","shortcut":"Shift+Meta+R"}],"type":"@WebInspector.ActionDelegate","actionId":"main.hard-reload"},{"className":"WebInspector.InspectorView.DrawerToggleActionDelegate","bindings":[{"shortcut":"Esc"}],"type":"@WebInspector.ActionDelegate","actionId":"main.toggle-drawer"},{"className":"WebInspector.Main.DebugReloadActionDelegate","bindings":[{"shortcut":"Alt+R"}],"type":"@WebInspector.ActionDelegate","actionId":"main.debug-reload"},{"className":"WebInspector.InspectElementModeController.ToggleSearchActionDelegate","bindings":[{"platform":"windows,linux","shortcut":"Ctrl+Shift+C"},{"platform":"mac","shortcut":"Meta+Shift+C"}],"type":"@WebInspector.ActionDelegate","actionId":"main.toggle-element-search"},{"className":"WebInspector.DockController.ToggleDockActionDelegate","bindings":[{"platform":"windows,linux","shortcut":"Ctrl+Shift+D"},{"platform":"mac","shortcut":"Meta+Shift+D"}],"type":"@WebInspector.ActionDelegate","actionId":"main.toggle-dock"},{"className":"WebInspector.Main.ZoomInActionDelegate","bindings":[{"platform":"windows,linux","shortcut":"Ctrl+Plus Ctrl+Shift+Plus Ctrl+NumpadPlus Ctrl+Shift+NumpadPlus"},{"platform":"mac","shortcut":"Meta+Plus Meta+Shift+Plus Meta+NumpadPlus Meta+Shift+NumpadPlus"}],"type":"@WebInspector.ActionDelegate","actionId":"main.zoom-in"},{"className":"WebInspector.Main.ZoomOutActionDelegate","bindings":[{"platform":"windows,linux","shortcut":"Ctrl+Minus Ctrl+Shift+Minus Ctrl+NumpadMinus Ctrl+Shift+NumpadMinus"},{"platform":"mac","shortcut":"Meta+Minus Meta+Shift+Minus Meta+NumpadMinus Meta+Shift+NumpadMinus"}],"type":"@WebInspector.ActionDelegate","actionId":"main.zoom-out"},{"className":"WebInspector.Main.ZoomResetActionDelegate","bindings":[{"platform":"windows,linux","shortcut":"Ctrl+0 Ctrl+Numpad0"},{"platform":"mac","shortcut":"Meta+0 Meta+Numpad0"}],"type":"@WebInspector.ActionDelegate","actionId":"main.zoom-reset"},{"className":"WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate","bindings":[{"platform":"windows,linux","shortcut":"Shift+Ctrl+M"},{"platform":"mac","shortcut":"Shift+Meta+M"}],"type":"@WebInspector.ActionDelegate","actionId":"main.toggle-device-mode"},{"className":"WebInspector.OverridesView","order":"10","type":"drawer-view","name":"emulation","title":"Emulation"},{"className":"WebInspector.RenderingOptions.View","order":"11","type":"drawer-view","name":"rendering","title":"Rendering"},{"className":"WebInspector.OverridesView.Revealer","contextTypes":["WebInspector.OverridesSupport"],"type":"@WebInspector.Revealer"},{"className":"WebInspector.InspectElementModeController.ToggleButtonProvider","actionId":"main.toggle-element-search","type":"@WebInspector.StatusBarItem.Provider","location":"toolbar-left","order":0},{"className":"WebInspector.AdvancedApp.EmulationButtonProvider","type":"@WebInspector.StatusBarItem.Provider","order":1,"location":"toolbar-left"},{"className":"WebInspector.AdvancedApp.DeviceCounter","type":"@WebInspector.StatusBarItem.Provider","order":0,"location":"toolbar-right"},{"className":"WebInspector.Main.WarningErrorCounter","type":"@WebInspector.StatusBarItem.Provider","order":1,"location":"toolbar-right"},{"className":"WebInspector.InspectorView.ToggleDrawerButtonProvider","type":"@WebInspector.StatusBarItem.Provider","order":2,"location":"toolbar-right"},{"className":"WebInspector.DockController.ButtonProvider","type":"@WebInspector.StatusBarItem.Provider","order":4,"location":"toolbar-right"},{"className":"WebInspector.ScreencastApp.StatusBarButtonProvider","type":"@WebInspector.StatusBarItem.Provider","order":5,"location":"toolbar-right"},{"settingType":"checkbox","type":"ui-setting","settingName":"cacheDisabled","title":"Disable cache (while DevTools is open)"},{"section":"Appearance","settingType":"checkbox","type":"ui-setting","settingName":"splitVerticallyWhenDockedToRight","title":"Split panels vertically when docked to right"},{"className":"WebInspector.Main.ShortcutPanelSwitchSettingDelegate","section":"Appearance","type":"ui-setting","settingType":"custom"},{"section":"Appearance","settingType":"checkbox","type":"ui-setting","settingName":"disableOverridesWarning","title":"Don't show emulation warnings"},{"section":"Appearance","settingType":"checkbox","type":"ui-setting","settingName":"disablePausedStateOverlay","title":"Disable paused state overlay"},{"className":"WebInspector.HandlerRegistry.OpenAnchorLocationSettingDelegate","section":"Extensions","type":"ui-setting","settingType":"custom"}],"name":"main","scripts":[],"skip_compilation":["Tests.js"]},{"dependencies":["source_frame"],"extensions":[{"className":"WebInspector.ResourcesPanelFactory","order":5,"type":"@WebInspector.PanelFactory","name":"resources","title":"Resources"},{"className":"WebInspector.ResourcesPanel.ResourceRevealer","contextTypes":["WebInspector.Resource"],"type":"@WebInspector.Revealer"}],"name":"resources","scripts":[]},{"skip_compilation":["../cm/headlesscodemirror.js","../cm/css.js","../cm/javascript.js","../cm/xml.js","../cm/htmlmixed.js","../UglifyJS/parse-js.js"],"name":"script_formatter_worker","scripts":[]},{"dependencies":["components","extensions"],"extensions":[{"className":"WebInspector.ElementsPanelFactory","order":0,"type":"@WebInspector.PanelFactory","name":"elements","title":"Elements"},{"className":"WebInspector.ElementsPanel.ContextMenuProvider","contextTypes":["WebInspector.RemoteObject","WebInspector.DOMNode","WebInspector.DeferredDOMNode"],"type":"@WebInspector.ContextMenu.Provider"},{"className":"WebInspector.ElementsTreeOutline.Renderer","contextTypes":["WebInspector.DOMNode","WebInspector.RemoteObject"],"type":"@WebInspector.Renderer"},{"className":"WebInspector.ElementsPanel.DOMNodeRevealer","contextTypes":["WebInspector.DOMNode","WebInspector.DeferredDOMNode","WebInspector.RemoteObject"],"type":"@WebInspector.Revealer"},{"title":"Color format:","section":"Elements","settingName":"colorFormat","settingType":"select","type":"ui-setting","options":[["As authored","original"],["HEX: #DAC0DE","hex",true],["RGB: rgb(128, 255, 255)","rgb",true],["HSL: hsl(300, 80%, 90%)","hsl",true]]},{"section":"Elements","settingType":"checkbox","type":"ui-setting","settingName":"showUserAgentStyles","title":"Show user agent styles"},{"section":"Elements","settingType":"checkbox","type":"ui-setting","settingName":"showUAShadowDOM","title":"Show user agent shadow DOM"},{"section":"Elements","settingType":"checkbox","type":"ui-setting","settingName":"domWordWrap","title":"Word wrap"},{"section":"Elements","settingType":"checkbox","type":"ui-setting","settingName":"showMetricsRulers","title":"Show rulers"},{"section":"Elements","settingType":"checkbox","type":"ui-setting","settingName":"highlightDOMUpdates","title":"Highlight DOM updates"}],"name":"elements","scripts":[]},{"dependencies":["common","host","platform"],"name":"workspace","scripts":[]},{"dependencies":["components"],"extensions":[{"className":"WebInspector.TimelinePanelFactory","order":3,"type":"@WebInspector.PanelFactory","name":"timeline","title":"Timeline"},{"section":"Profiler","settingType":"checkbox","type":"ui-setting","settingName":"frameViewerHideChromeWindow","title":"Hide chrome frame in Layers view"}],"name":"timeline","scripts":[]},{"dependencies":["common","platform"],"name":"host","scripts":[]},{"dependencies":["platform","common","host"],"name":"ui","scripts":[]},{"dependencies":["bindings","platform","ui"],"name":"toolbox","scripts":[]},{"skip_compilation":["../InspectorBackendCommands.js","../SupportedCSSProperties.js"],"dependencies":["common","host","platform"],"name":"sdk","scripts":[]},{"name":"temp_storage_shared_worker","scripts":[]},{"dependencies":["components"],"extensions":[{"className":"WebInspector.SettingsController.SettingsScreenActionDelegate","bindings":[{"shortcut":"F1 Shift+?"}],"type":"@WebInspector.ActionDelegate","actionId":"settings.show"},{"title":"Settings","elementClass":"settings-status-bar-item","actionId":"settings.show","type":"@WebInspector.StatusBarItem.Provider","order":3,"location":"toolbar-right"},{"className":"WebInspector.SettingsScreen.SkipStackFramePatternSettingDelegate","section":"Sources","type":"ui-setting","settingType":"custom"}],"name":"settings","scripts":[]},{"dependencies":["platform","sdk","ui"],"extensions":[{"name":"devices","title":"Devices","className":"WebInspector.DevicesView","experiment":"devicesPanel","type":"drawer-view","order":"12"}],"name":"devices","scripts":[]},{"dependencies":["components"],"extensions":[{"className":"WebInspector.ProfilesPanelFactory","order":4,"type":"@WebInspector.PanelFactory","name":"profiles","title":"Profiles"},{"className":"WebInspector.ProfilesPanel.ContextMenuProvider","contextTypes":["WebInspector.RemoteObject"],"type":"@WebInspector.ContextMenu.Provider"},{"section":"Profiler","settingType":"checkbox","type":"ui-setting","settingName":"showAdvancedHeapSnapshotProperties","title":"Show advanced heap snapshot properties"},{"section":"Profiler","settingType":"checkbox","type":"ui-setting","settingName":"recordAllocationStacks","title":"Record heap allocation stack traces"},{"section":"Profiler","settingType":"checkbox","type":"ui-setting","settingName":"highResolutionCpuProfiling","title":"High resolution CPU profiling"}],"name":"profiler","scripts":[]},{"dependencies":["components"],"name":"screencast","scripts":[]},{"dependencies":["components"],"name":"extensions","scripts":[]},{"dependencies":["platform"],"name":"common","scripts":[]},{"dependencies":["bindings","platform","ui"],"extensions":[{"title":"Enable custom formatters","section":"Console","experiment":"customObjectFormatters","settingName":"enableCustomFormatters","settingType":"checkbox","type":"ui-setting"}],"name":"components","scripts":[]}];var applicationDescriptor;var _loadedScripts={};for(var k of[]);function loadResourcePromise(url)
  2. {return new Promise(load);function load(fulfill,reject)
  3. {var xhr=new XMLHttpRequest();xhr.open("GET",url,true);xhr.onreadystatechange=onreadystatechange;function onreadystatechange(e)
  4. {if(xhr.readyState!==4)
  5. return;if([0,200,304].indexOf(xhr.status)===-1)
  6. reject(new Error("While loading from url "+url+" server responded with a status of "+xhr.status));else
  7. fulfill(e.target.response);}
  8. xhr.send(null);}}
  9. function normalizePath(path)
  10. {if(path.indexOf("..")===-1&&path.indexOf('.')===-1)
  11. return path;var normalizedSegments=[];var segments=path.split("/");for(var i=0;i<segments.length;i++){var segment=segments[i];if(segment===".")
  12. continue;else if(segment==="..")
  13. normalizedSegments.pop();else if(segment)
  14. normalizedSegments.push(segment);}
  15. var normalizedPath=normalizedSegments.join("/");if(normalizedPath[normalizedPath.length-1]==="/")
  16. return normalizedPath;if(path[0]==="/"&&normalizedPath)
  17. normalizedPath="/"+normalizedPath;if((path[path.length-1]==="/")||(segments[segments.length-1]===".")||(segments[segments.length-1]===".."))
  18. normalizedPath=normalizedPath+"/";return normalizedPath;}
  19. function loadScriptsPromise(scriptNames)
  20. {var promises=[];var urls=[];var sources=new Array(scriptNames.length);var scriptToEval=0;for(var i=0;i<scriptNames.length;++i){var scriptName=scriptNames[i];var sourceURL=self._importScriptPathPrefix+scriptName;var schemaIndex=sourceURL.indexOf("://")+3;sourceURL=sourceURL.substring(0,schemaIndex)+normalizePath(sourceURL.substring(schemaIndex));if(_loadedScripts[sourceURL])
  21. continue;urls.push(sourceURL);promises.push(loadResourcePromise(sourceURL).then(scriptSourceLoaded.bind(null,i),scriptSourceLoaded.bind(null,i,undefined)));}
  22. return Promise.all(promises).then(undefined);function scriptSourceLoaded(scriptNumber,scriptSource)
  23. {sources[scriptNumber]=scriptSource||"";while(typeof sources[scriptToEval]!=="undefined"){evaluateScript(urls[scriptToEval],sources[scriptToEval]);++scriptToEval;}}
  24. function evaluateScript(sourceURL,scriptSource)
  25. {_loadedScripts[sourceURL]=true;if(!scriptSource){console.error("Empty response arrived for script '"+sourceURL+"'");return;}
  26. self.eval(scriptSource+"\n//# sourceURL="+sourceURL);}}
  27. (function(){var baseUrl=self.location?self.location.origin+self.location.pathname:"";self._importScriptPathPrefix=baseUrl.substring(0,baseUrl.lastIndexOf("/")+1);})();function Runtime(descriptors,coreModuleNames)
  28. {this._modules=[];this._modulesMap={};this._extensions=[];this._cachedTypeClasses={};this._descriptorsMap={};for(var i=0;i<descriptors.length;++i)
  29. this._registerModule(descriptors[i]);if(coreModuleNames)
  30. this._loadAutoStartModules(coreModuleNames);}
  31. Runtime._queryParamsObject={__proto__:null};Runtime.cachedResources={__proto__:null};Runtime.isReleaseMode=function()
  32. {return!!allDescriptors.length;}
  33. Runtime.startApplication=function(appName)
  34. {console.timeStamp("Runtime.startApplication");var allDescriptorsByName={};for(var i=0;Runtime.isReleaseMode()&&i<allDescriptors.length;++i){var d=allDescriptors[i];allDescriptorsByName[d["name"]]=d;}
  35. var applicationPromise;if(applicationDescriptor)
  36. applicationPromise=Promise.resolve(applicationDescriptor);else
  37. applicationPromise=loadResourcePromise(appName+".json").then(JSON.parse.bind(JSON));applicationPromise.then(parseModuleDescriptors);function parseModuleDescriptors(configuration)
  38. {var moduleJSONPromises=[];var coreModuleNames=[];for(var i=0;i<configuration.length;++i){var descriptor=configuration[i];if(descriptor["type"]==="worker")
  39. continue;var name=descriptor["name"];var moduleJSON=allDescriptorsByName[name];if(moduleJSON)
  40. moduleJSONPromises.push(Promise.resolve(moduleJSON));else
  41. moduleJSONPromises.push(loadResourcePromise(name+"/module.json").then(JSON.parse.bind(JSON)));if(descriptor["type"]==="autostart")
  42. coreModuleNames.push(name);}
  43. Promise.all(moduleJSONPromises).then(instantiateRuntime);function instantiateRuntime(moduleDescriptors)
  44. {for(var i=0;!Runtime.isReleaseMode()&&i<moduleDescriptors.length;++i)
  45. moduleDescriptors[i]["name"]=configuration[i]["name"];self.runtime=new Runtime(moduleDescriptors,coreModuleNames);}}}
  46. Runtime.queryParam=function(name)
  47. {return Runtime._queryParamsObject[name]||null;}
  48. Runtime.constructQueryParams=function(banned)
  49. {var params=[];for(var key in Runtime._queryParamsObject){if(!key||banned.indexOf(key)!==-1)
  50. continue;params.push(key+"="+Runtime._queryParamsObject[key]);}
  51. return params.length?"?"+params.join("&"):"";}
  52. Runtime._experimentsSetting=function()
  53. {try{return(JSON.parse(self.localStorage&&self.localStorage["experiments"]?self.localStorage["experiments"]:"{}"));}catch(e){console.error("Failed to parse localStorage['experiments']");return{};}}
  54. Runtime._some=function(promises)
  55. {var all=[];var wasRejected=[];for(var i=0;i<promises.length;++i){var handlerFunction=(handler.bind(promises[i],i));all.push(promises[i].catch(handlerFunction));}
  56. return Promise.all(all).then(filterOutFailuresResults);function filterOutFailuresResults(results)
  57. {var filtered=[];for(var i=0;i<results.length;++i){if(!wasRejected[i])
  58. filtered.push(results[i]);}
  59. return filtered;}
  60. function handler(index,e)
  61. {wasRejected[index]=true;console.error(e.stack);}}
  62. Runtime._console=console;Runtime._originalAssert=console.assert;Runtime._assert=function(value,message)
  63. {if(value)
  64. return;Runtime._originalAssert.call(Runtime._console,value,message);}
  65. Runtime.prototype={_registerModule:function(descriptor)
  66. {var module=new Runtime.Module(this,descriptor);this._modules.push(module);this._modulesMap[descriptor["name"]]=module;},loadModulePromise:function(moduleName)
  67. {return this._modulesMap[moduleName]._loadPromise();},_loadAutoStartModules:function(moduleNames)
  68. {var promises=[];for(var i=0;i<moduleNames.length;++i){if(Runtime.isReleaseMode())
  69. this._modulesMap[moduleNames[i]]._loaded=true;else
  70. promises.push(this.loadModulePromise(moduleNames[i]));}
  71. return Promise.all(promises);},_checkExtensionApplicability:function(extension,predicate)
  72. {if(!predicate)
  73. return false;var contextTypes=(extension.descriptor().contextTypes);if(!contextTypes)
  74. return true;for(var i=0;i<contextTypes.length;++i){var contextType=this._resolve(contextTypes[i]);var isMatching=!!contextType&&predicate(contextType);if(isMatching)
  75. return true;}
  76. return false;},isExtensionApplicableToContext:function(extension,context)
  77. {if(!context)
  78. return true;return this._checkExtensionApplicability(extension,isInstanceOf);function isInstanceOf(targetType)
  79. {return context instanceof targetType;}},isExtensionApplicableToContextTypes:function(extension,currentContextTypes)
  80. {if(!extension.descriptor().contextTypes)
  81. return true;return this._checkExtensionApplicability(extension,currentContextTypes?isContextTypeKnown:null);function isContextTypeKnown(targetType)
  82. {return currentContextTypes.has(targetType);}},extensions:function(type,context)
  83. {return this._extensions.filter(filter).sort(orderComparator);function filter(extension)
  84. {if(extension._type!==type&&extension._typeClass()!==type)
  85. return false;var activatorExperiment=extension.descriptor()["experiment"];if(activatorExperiment&&!Runtime.experiments.isEnabled(activatorExperiment))
  86. return false;activatorExperiment=extension._module._descriptor["experiment"];if(activatorExperiment&&!Runtime.experiments.isEnabled(activatorExperiment))
  87. return false;return!context||extension.isApplicable(context);}
  88. function orderComparator(extension1,extension2)
  89. {var order1=extension1.descriptor()["order"]||0;var order2=extension2.descriptor()["order"]||0;return order1-order2;}},extension:function(type,context)
  90. {return this.extensions(type,context)[0]||null;},instancesPromise:function(type,context)
  91. {var extensions=this.extensions(type,context);var promises=[];for(var i=0;i<extensions.length;++i)
  92. promises.push(extensions[i].instancePromise());return Runtime._some(promises);},instancePromise:function(type,context)
  93. {var extension=this.extension(type,context);if(!extension)
  94. return Promise.reject(new Error("No such extension: "+type+" in given context."));return extension.instancePromise();},_resolve:function(typeName)
  95. {if(!this._cachedTypeClasses[typeName]){var path=typeName.split(".");var object=window;for(var i=0;object&&(i<path.length);++i)
  96. object=object[path[i]];if(object)
  97. this._cachedTypeClasses[typeName]=(object);}
  98. return this._cachedTypeClasses[typeName]||null;}}
  99. Runtime.ModuleDescriptor=function()
  100. {this.name;this.extensions;this.dependencies;this.scripts;}
  101. Runtime.ExtensionDescriptor=function()
  102. {this.type;this.className;this.contextTypes;}
  103. Runtime.Module=function(manager,descriptor)
  104. {this._manager=manager;this._descriptor=descriptor;this._name=descriptor.name;this._instanceMap={};var extensions=(descriptor.extensions);for(var i=0;extensions&&i<extensions.length;++i)
  105. this._manager._extensions.push(new Runtime.Extension(this,extensions[i]));this._loaded=false;}
  106. Runtime.Module.prototype={name:function()
  107. {return this._name;},_loadPromise:function()
  108. {if(this._loaded)
  109. return Promise.resolve();if(this._pendingLoadPromise)
  110. return this._pendingLoadPromise;var dependencies=this._descriptor.dependencies;var dependencyPromises=[];for(var i=0;dependencies&&i<dependencies.length;++i)
  111. dependencyPromises.push(this._manager._modulesMap[dependencies[i]]._loadPromise());this._pendingLoadPromise=Promise.all(dependencyPromises).then(this._loadStylesheets.bind(this)).then(this._loadScripts.bind(this)).then(markAsLoaded.bind(this));return this._pendingLoadPromise;function markAsLoaded()
  112. {delete this._pendingLoadPromise;this._loaded=true;}},_loadStylesheets:function()
  113. {var stylesheets=this._descriptor["stylesheets"];if(!stylesheets)
  114. return Promise.resolve();var promises=[];for(var i=0;i<stylesheets.length;++i){var url=this._modularizeURL(stylesheets[i]);promises.push(loadResourcePromise(url).then(cacheStylesheet.bind(this,url),cacheStylesheet.bind(this,url,undefined)));}
  115. return Promise.all(promises).then(undefined);function cacheStylesheet(path,content)
  116. {if(!content){console.error("Failed to load stylesheet: "+path);return;}
  117. var sourceURL=window.location.href;if(window.location.search)
  118. sourceURL.replace(window.location.search,"");sourceURL=sourceURL.substring(0,sourceURL.lastIndexOf("/")+1)+path;Runtime.cachedResources[path]=content+"\n/*# sourceURL="+sourceURL+" */";}},_loadScripts:function()
  119. {if(!this._descriptor.scripts)
  120. return Promise.resolve();if(Runtime.isReleaseMode())
  121. return loadScriptsPromise([this._name+"_module.js"]);return loadScriptsPromise(this._descriptor.scripts.map(this._modularizeURL,this));},_modularizeURL:function(resourceName)
  122. {return normalizePath(this._name+"/"+resourceName);},_instance:function(className)
  123. {if(className in this._instanceMap)
  124. return this._instanceMap[className];var constructorFunction=window.eval(className);if(!(constructorFunction instanceof Function)){this._instanceMap[className]=null;return null;}
  125. var instance=new constructorFunction();this._instanceMap[className]=instance;return instance;}}
  126. Runtime.Extension=function(module,descriptor)
  127. {this._module=module;this._descriptor=descriptor;this._type=descriptor.type;this._hasTypeClass=this._type.charAt(0)==="@";this._className=descriptor.className||null;}
  128. Runtime.Extension.prototype={descriptor:function()
  129. {return this._descriptor;},module:function()
  130. {return this._module;},_typeClass:function()
  131. {if(!this._hasTypeClass)
  132. return null;return this._module._manager._resolve(this._type.substring(1));},isApplicable:function(context)
  133. {return this._module._manager.isExtensionApplicableToContext(this,context);},instancePromise:function()
  134. {if(!this._className)
  135. return Promise.reject(new Error("No class name in extension"));var className=this._className;if(this._instance)
  136. return Promise.resolve(this._instance);return this._module._loadPromise().then(constructInstance.bind(this));function constructInstance()
  137. {var result=this._module._instance(className);if(!result)
  138. return Promise.reject("Could not instantiate: "+className);return result;}}}
  139. Runtime.ExperimentsSupport=function()
  140. {this._supportEnabled=Runtime.queryParam("experiments")!==null;this._experiments=[];this._experimentNames={};this._enabledTransiently={};}
  141. Runtime.ExperimentsSupport.prototype={allConfigurableExperiments:function()
  142. {var result=[];for(var i=0;i<this._experiments.length;i++){var experiment=this._experiments[i];if(!this._enabledTransiently[experiment.name])
  143. result.push(experiment);}
  144. return result;},supportEnabled:function()
  145. {return this._supportEnabled;},_setExperimentsSetting:function(value)
  146. {if(!self.localStorage)
  147. return;self.localStorage["experiments"]=JSON.stringify(value);},register:function(experimentName,experimentTitle,hidden)
  148. {Runtime._assert(!this._experimentNames[experimentName],"Duplicate registration of experiment "+experimentName);this._experimentNames[experimentName]=true;this._experiments.push(new Runtime.Experiment(this,experimentName,experimentTitle,!!hidden));},isEnabled:function(experimentName)
  149. {this._checkExperiment(experimentName);if(this._enabledTransiently[experimentName])
  150. return true;if(!this.supportEnabled())
  151. return false;return!!Runtime._experimentsSetting()[experimentName];},setEnabled:function(experimentName,enabled)
  152. {this._checkExperiment(experimentName);var experimentsSetting=Runtime._experimentsSetting();experimentsSetting[experimentName]=enabled;this._setExperimentsSetting(experimentsSetting);},setDefaultExperiments:function(experimentNames)
  153. {for(var i=0;i<experimentNames.length;++i){this._checkExperiment(experimentNames[i]);this._enabledTransiently[experimentNames[i]]=true;}},enableForTest:function(experimentName)
  154. {this._checkExperiment(experimentName);this._enabledTransiently[experimentName]=true;},cleanUpStaleExperiments:function()
  155. {var experimentsSetting=Runtime._experimentsSetting();var cleanedUpExperimentSetting={};for(var i=0;i<this._experiments.length;++i){var experimentName=this._experiments[i].name;if(experimentsSetting[experimentName])
  156. cleanedUpExperimentSetting[experimentName]=true;}
  157. this._setExperimentsSetting(cleanedUpExperimentSetting);},_checkExperiment:function(experimentName)
  158. {Runtime._assert(this._experimentNames[experimentName],"Unknown experiment "+experimentName);}}
  159. Runtime.Experiment=function(experiments,name,title,hidden)
  160. {this.name=name;this.title=title;this.hidden=hidden;this._experiments=experiments;}
  161. Runtime.Experiment.prototype={isEnabled:function()
  162. {return this._experiments.isEnabled(this.name);},setEnabled:function(enabled)
  163. {this._experiments.setEnabled(this.name,enabled);}}
  164. {(function parseQueryParameters()
  165. {var queryParams=location.search;if(!queryParams)
  166. return;var params=queryParams.substring(1).split("&");for(var i=0;i<params.length;++i){var pair=params[i].split("=");Runtime._queryParamsObject[pair[0]]=pair[1];}
  167. var settingsParam=Runtime.queryParam("settings");if(settingsParam){try{var settings=JSON.parse(window.decodeURI(settingsParam));for(var key in settings)
  168. window.localStorage[key]=settings[key];}catch(e){}}})();}
  169. Runtime.experiments=new Runtime.ExperimentsSupport();var runtime;console=console;console.__originalAssert=console.assert;console.assert=function(value,message)
  170. {if(value)
  171. return;console.__originalAssert(value,message);}
  172. var ArrayLike;Object.isEmpty=function(obj)
  173. {for(var i in obj)
  174. return false;return true;}
  175. Object.values=function(obj)
  176. {var result=Object.keys(obj);var length=result.length;for(var i=0;i<length;++i)
  177. result[i]=obj[result[i]];return result;}
  178. function mod(m,n)
  179. {return((m%n)+n)%n;}
  180. String.prototype.findAll=function(string)
  181. {var matches=[];var i=this.indexOf(string);while(i!==-1){matches.push(i);i=this.indexOf(string,i+string.length);}
  182. return matches;}
  183. String.prototype.lineEndings=function()
  184. {if(!this._lineEndings){this._lineEndings=this.findAll("\n");this._lineEndings.push(this.length);}
  185. return this._lineEndings;}
  186. String.prototype.lineCount=function()
  187. {var lineEndings=this.lineEndings();return lineEndings.length;}
  188. String.prototype.lineAt=function(lineNumber)
  189. {var lineEndings=this.lineEndings();var lineStart=lineNumber>0?lineEndings[lineNumber-1]+1:0;var lineEnd=lineEndings[lineNumber];var lineContent=this.substring(lineStart,lineEnd);if(lineContent.length>0&&lineContent.charAt(lineContent.length-1)==="\r")
  190. lineContent=lineContent.substring(0,lineContent.length-1);return lineContent;}
  191. String.prototype.escapeCharacters=function(chars)
  192. {var foundChar=false;for(var i=0;i<chars.length;++i){if(this.indexOf(chars.charAt(i))!==-1){foundChar=true;break;}}
  193. if(!foundChar)
  194. return String(this);var result="";for(var i=0;i<this.length;++i){if(chars.indexOf(this.charAt(i))!==-1)
  195. result+="\\";result+=this.charAt(i);}
  196. return result;}
  197. String.regexSpecialCharacters=function()
  198. {return"^[]{}()\\.^$*+?|-,";}
  199. String.prototype.escapeForRegExp=function()
  200. {return this.escapeCharacters(String.regexSpecialCharacters());}
  201. String.prototype.escapeHTML=function()
  202. {return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");}
  203. String.prototype.unescapeHTML=function()
  204. {return this.replace(/</g,"<").replace(/>/g,">").replace(/:/g,":").replace(/"/g,"\"").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");}
  205. String.prototype.collapseWhitespace=function()
  206. {return this.replace(/[\s\xA0]+/g," ");}
  207. String.prototype.trimMiddle=function(maxLength)
  208. {if(this.length<=maxLength)
  209. return String(this);var leftHalf=maxLength>>1;var rightHalf=maxLength-leftHalf-1;return this.substr(0,leftHalf)+"\u2026"+this.substr(this.length-rightHalf,rightHalf);}
  210. String.prototype.trimEnd=function(maxLength)
  211. {if(this.length<=maxLength)
  212. return String(this);return this.substr(0,maxLength-1)+"\u2026";}
  213. String.prototype.trimURL=function(baseURLDomain)
  214. {var result=this.replace(/^(https|http|file):\/\//i,"");if(baseURLDomain)
  215. result=result.replace(new RegExp("^"+baseURLDomain.escapeForRegExp(),"i"),"");return result;}
  216. String.prototype.toTitleCase=function()
  217. {return this.substring(0,1).toUpperCase()+this.substring(1);}
  218. String.prototype.compareTo=function(other)
  219. {if(this>other)
  220. return 1;if(this<other)
  221. return-1;return 0;}
  222. function sanitizeHref(href)
  223. {return href&&href.trim().toLowerCase().startsWith("javascript:")?null:href;}
  224. String.prototype.removeURLFragment=function()
  225. {var fragmentIndex=this.indexOf("#");if(fragmentIndex==-1)
  226. fragmentIndex=this.length;return this.substring(0,fragmentIndex);}
  227. String.prototype.startsWith=function(substring)
  228. {return!this.lastIndexOf(substring,0);}
  229. String.prototype.endsWith=function(substring)
  230. {return this.indexOf(substring,this.length-substring.length)!==-1;}
  231. String.prototype.hashCode=function()
  232. {var result=0;for(var i=0;i<this.length;++i)
  233. result=(result*3+this.charCodeAt(i))|0;return result;}
  234. String.prototype.isDigitAt=function(index)
  235. {var c=this.charCodeAt(index);return 48<=c&&c<=57;}
  236. String.naturalOrderComparator=function(a,b)
  237. {var chunk=/^\d+|^\D+/;var chunka,chunkb,anum,bnum;while(1){if(a){if(!b)
  238. return 1;}else{if(b)
  239. return-1;else
  240. return 0;}
  241. chunka=a.match(chunk)[0];chunkb=b.match(chunk)[0];anum=!isNaN(chunka);bnum=!isNaN(chunkb);if(anum&&!bnum)
  242. return-1;if(bnum&&!anum)
  243. return 1;if(anum&&bnum){var diff=chunka-chunkb;if(diff)
  244. return diff;if(chunka.length!==chunkb.length){if(!+chunka&&!+chunkb)
  245. return chunka.length-chunkb.length;else
  246. return chunkb.length-chunka.length;}}else if(chunka!==chunkb)
  247. return(chunka<chunkb)?-1:1;a=a.substring(chunka.length);b=b.substring(chunkb.length);}}
  248. Number.constrain=function(num,min,max)
  249. {if(num<min)
  250. num=min;else if(num>max)
  251. num=max;return num;}
  252. Number.gcd=function(a,b)
  253. {if(b===0)
  254. return a;else
  255. return Number.gcd(b,a%b);}
  256. Number.toFixedIfFloating=function(value)
  257. {if(!value||isNaN(value))
  258. return value;var number=Number(value);return number%1?number.toFixed(3):String(number);}
  259. Date.prototype.toISO8601Compact=function()
  260. {function leadZero(x)
  261. {return(x>9?"":"0")+x;}
  262. return this.getFullYear()+
  263. leadZero(this.getMonth()+1)+
  264. leadZero(this.getDate())+"T"+
  265. leadZero(this.getHours())+
  266. leadZero(this.getMinutes())+
  267. leadZero(this.getSeconds());}
  268. Date.prototype.toConsoleTime=function()
  269. {function leadZero2(x)
  270. {return(x>9?"":"0")+x;}
  271. function leadZero3(x)
  272. {return(Array(4-x.toString().length)).join('0')+x;}
  273. return this.getFullYear()+"-"+
  274. leadZero2(this.getMonth()+1)+"-"+
  275. leadZero2(this.getDate())+" "+
  276. leadZero2(this.getHours())+":"+
  277. leadZero2(this.getMinutes())+":"+
  278. leadZero2(this.getSeconds())+"."+
  279. leadZero3(this.getMilliseconds());}
  280. Object.defineProperty(Array.prototype,"remove",{value:function(value,firstOnly)
  281. {var index=this.indexOf(value);if(index===-1)
  282. return;if(firstOnly){this.splice(index,1);return;}
  283. for(var i=index+1,n=this.length;i<n;++i){if(this[i]!==value)
  284. this[index++]=this[i];}
  285. this.length=index;}});Object.defineProperty(Array.prototype,"keySet",{value:function()
  286. {var keys={};for(var i=0;i<this.length;++i)
  287. keys[this[i]]=true;return keys;}});Object.defineProperty(Array.prototype,"pushAll",{value:function(array)
  288. {Array.prototype.push.apply(this,array);}});Object.defineProperty(Array.prototype,"rotate",{value:function(index)
  289. {var result=[];for(var i=index;i<index+this.length;++i)
  290. result.push(this[i%this.length]);return result;}});Object.defineProperty(Array.prototype,"sortNumbers",{value:function()
  291. {function numericComparator(a,b)
  292. {return a-b;}
  293. this.sort(numericComparator);}});Object.defineProperty(Uint32Array.prototype,"sort",{value:Array.prototype.sort});(function(){var partition={value:function(comparator,left,right,pivotIndex)
  294. {function swap(array,i1,i2)
  295. {var temp=array[i1];array[i1]=array[i2];array[i2]=temp;}
  296. var pivotValue=this[pivotIndex];swap(this,right,pivotIndex);var storeIndex=left;for(var i=left;i<right;++i){if(comparator(this[i],pivotValue)<0){swap(this,storeIndex,i);++storeIndex;}}
  297. swap(this,right,storeIndex);return storeIndex;}};Object.defineProperty(Array.prototype,"partition",partition);Object.defineProperty(Uint32Array.prototype,"partition",partition);var sortRange={value:function(comparator,leftBound,rightBound,sortWindowLeft,sortWindowRight)
  298. {function quickSortRange(array,comparator,left,right,sortWindowLeft,sortWindowRight)
  299. {if(right<=left)
  300. return;var pivotIndex=Math.floor(Math.random()*(right-left))+left;var pivotNewIndex=array.partition(comparator,left,right,pivotIndex);if(sortWindowLeft<pivotNewIndex)
  301. quickSortRange(array,comparator,left,pivotNewIndex-1,sortWindowLeft,sortWindowRight);if(pivotNewIndex<sortWindowRight)
  302. quickSortRange(array,comparator,pivotNewIndex+1,right,sortWindowLeft,sortWindowRight);}
  303. if(leftBound===0&&rightBound===(this.length-1)&&sortWindowLeft===0&&sortWindowRight>=rightBound)
  304. this.sort(comparator);else
  305. quickSortRange(this,comparator,leftBound,rightBound,sortWindowLeft,sortWindowRight);return this;}}
  306. Object.defineProperty(Array.prototype,"sortRange",sortRange);Object.defineProperty(Uint32Array.prototype,"sortRange",sortRange);})();Object.defineProperty(Array.prototype,"stableSort",{value:function(comparator)
  307. {function defaultComparator(a,b)
  308. {return a<b?-1:(a>b?1:0);}
  309. comparator=comparator||defaultComparator;var indices=new Array(this.length);for(var i=0;i<this.length;++i)
  310. indices[i]=i;var self=this;function indexComparator(a,b)
  311. {var result=comparator(self[a],self[b]);return result?result:a-b;}
  312. indices.sort(indexComparator);for(var i=0;i<this.length;++i){if(indices[i]<0||i===indices[i])
  313. continue;var cyclical=i;var saved=this[i];while(true){var next=indices[cyclical];indices[cyclical]=-1;if(next===i){this[cyclical]=saved;break;}else{this[cyclical]=this[next];cyclical=next;}}}
  314. return this;}});Object.defineProperty(Array.prototype,"qselect",{value:function(k,comparator)
  315. {if(k<0||k>=this.length)
  316. return;if(!comparator)
  317. comparator=function(a,b){return a-b;}
  318. var low=0;var high=this.length-1;for(;;){var pivotPosition=this.partition(comparator,low,high,Math.floor((high+low)/2));if(pivotPosition===k)
  319. return this[k];else if(pivotPosition>k)
  320. high=pivotPosition-1;else
  321. low=pivotPosition+1;}}});Object.defineProperty(Array.prototype,"lowerBound",{value:function(object,comparator,left,right)
  322. {function defaultComparator(a,b)
  323. {return a<b?-1:(a>b?1:0);}
  324. comparator=comparator||defaultComparator;var l=left||0;var r=right!==undefined?right:this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>0)
  325. l=m+1;else
  326. r=m;}
  327. return r;}});Object.defineProperty(Array.prototype,"upperBound",{value:function(object,comparator,left,right)
  328. {function defaultComparator(a,b)
  329. {return a<b?-1:(a>b?1:0);}
  330. comparator=comparator||defaultComparator;var l=left||0;var r=right!==undefined?right:this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>=0)
  331. l=m+1;else
  332. r=m;}
  333. return r;}});Object.defineProperty(Uint32Array.prototype,"lowerBound",{value:Array.prototype.lowerBound});Object.defineProperty(Uint32Array.prototype,"upperBound",{value:Array.prototype.upperBound});Object.defineProperty(Float64Array.prototype,"lowerBound",{value:Array.prototype.lowerBound});Object.defineProperty(Array.prototype,"binaryIndexOf",{value:function(value,comparator)
  334. {var index=this.lowerBound(value,comparator);return index<this.length&&comparator(value,this[index])===0?index:-1;}});Object.defineProperty(Array.prototype,"select",{value:function(field)
  335. {var result=new Array(this.length);for(var i=0;i<this.length;++i)
  336. result[i]=this[i][field];return result;}});Object.defineProperty(Array.prototype,"peekLast",{value:function()
  337. {return this[this.length-1];}});(function(){function mergeOrIntersect(array1,array2,comparator,mergeNotIntersect)
  338. {var result=[];var i=0;var j=0;while(i<array1.length&&j<array2.length){var compareValue=comparator(array1[i],array2[j]);if(mergeNotIntersect||!compareValue)
  339. result.push(compareValue<=0?array1[i]:array2[j]);if(compareValue<=0)
  340. i++;if(compareValue>=0)
  341. j++;}
  342. if(mergeNotIntersect){while(i<array1.length)
  343. result.push(array1[i++]);while(j<array2.length)
  344. result.push(array2[j++]);}
  345. return result;}
  346. Object.defineProperty(Array.prototype,"intersectOrdered",{value:function(array,comparator)
  347. {return mergeOrIntersect(this,array,comparator,false);}});Object.defineProperty(Array.prototype,"mergeOrdered",{value:function(array,comparator)
  348. {return mergeOrIntersect(this,array,comparator,true);}});}());function insertionIndexForObjectInListSortedByFunction(object,list,comparator,insertionIndexAfter)
  349. {if(insertionIndexAfter)
  350. return list.upperBound(object,comparator);else
  351. return list.lowerBound(object,comparator);}
  352. String.sprintf=function(format,var_arg)
  353. {return String.vsprintf(format,Array.prototype.slice.call(arguments,1));}
  354. String.tokenizeFormatString=function(format,formatters)
  355. {var tokens=[];var substitutionIndex=0;function addStringToken(str)
  356. {tokens.push({type:"string",value:str});}
  357. function addSpecifierToken(specifier,precision,substitutionIndex)
  358. {tokens.push({type:"specifier",specifier:specifier,precision:precision,substitutionIndex:substitutionIndex});}
  359. var index=0;for(var precentIndex=format.indexOf("%",index);precentIndex!==-1;precentIndex=format.indexOf("%",index)){addStringToken(format.substring(index,precentIndex));index=precentIndex+1;if(format[index]==="%"){addStringToken("%");++index;continue;}
  360. if(format.isDigitAt(index)){var number=parseInt(format.substring(index),10);while(format.isDigitAt(index))
  361. ++index;if(number>0&&format[index]==="$"){substitutionIndex=(number-1);++index;}}
  362. var precision=-1;if(format[index]==="."){++index;precision=parseInt(format.substring(index),10);if(isNaN(precision))
  363. precision=0;while(format.isDigitAt(index))
  364. ++index;}
  365. if(!(format[index]in formatters)){addStringToken(format.substring(precentIndex,index+1));++index;continue;}
  366. addSpecifierToken(format[index],precision,substitutionIndex);++substitutionIndex;++index;}
  367. addStringToken(format.substring(index));return tokens;}
  368. String.standardFormatters={d:function(substitution)
  369. {return!isNaN(substitution)?substitution:0;},f:function(substitution,token)
  370. {if(substitution&&token.precision>-1)
  371. substitution=substitution.toFixed(token.precision);return!isNaN(substitution)?substitution:(token.precision>-1?Number(0).toFixed(token.precision):0);},s:function(substitution)
  372. {return substitution;}}
  373. String.vsprintf=function(format,substitutions)
  374. {return String.format(format,substitutions,String.standardFormatters,"",function(a,b){return a+b;}).formattedResult;}
  375. String.format=function(format,substitutions,formatters,initialValue,append,tokenizedFormat)
  376. {if(!format||!substitutions||!substitutions.length)
  377. return{formattedResult:append(initialValue,format),unusedSubstitutions:substitutions};function prettyFunctionName()
  378. {return"String.format(\""+format+"\", \""+Array.prototype.join.call(substitutions,"\", \"")+"\")";}
  379. function warn(msg)
  380. {console.warn(prettyFunctionName()+": "+msg);}
  381. function error(msg)
  382. {console.error(prettyFunctionName()+": "+msg);}
  383. var result=initialValue;var tokens=tokenizedFormat||String.tokenizeFormatString(format,formatters);var usedSubstitutionIndexes={};for(var i=0;i<tokens.length;++i){var token=tokens[i];if(token.type==="string"){result=append(result,token.value);continue;}
  384. if(token.type!=="specifier"){error("Unknown token type \""+token.type+"\" found.");continue;}
  385. if(token.substitutionIndex>=substitutions.length){error("not enough substitution arguments. Had "+substitutions.length+" but needed "+(token.substitutionIndex+1)+", so substitution was skipped.");result=append(result,"%"+(token.precision>-1?token.precision:"")+token.specifier);continue;}
  386. usedSubstitutionIndexes[token.substitutionIndex]=true;if(!(token.specifier in formatters)){warn("unsupported format character \u201C"+token.specifier+"\u201D. Treating as a string.");result=append(result,substitutions[token.substitutionIndex]);continue;}
  387. result=append(result,formatters[token.specifier](substitutions[token.substitutionIndex],token));}
  388. var unusedSubstitutions=[];for(var i=0;i<substitutions.length;++i){if(i in usedSubstitutionIndexes)
  389. continue;unusedSubstitutions.push(substitutions[i]);}
  390. return{formattedResult:result,unusedSubstitutions:unusedSubstitutions};}
  391. function createSearchRegex(query,caseSensitive,isRegex)
  392. {var regexFlags=caseSensitive?"g":"gi";var regexObject;if(isRegex){try{regexObject=new RegExp(query,regexFlags);}catch(e){}}
  393. if(!regexObject)
  394. regexObject=createPlainTextSearchRegex(query,regexFlags);return regexObject;}
  395. function createPlainTextSearchRegex(query,flags)
  396. {var regexSpecialCharacters=String.regexSpecialCharacters();var regex="";for(var i=0;i<query.length;++i){var c=query.charAt(i);if(regexSpecialCharacters.indexOf(c)!=-1)
  397. regex+="\\";regex+=c;}
  398. return new RegExp(regex,flags||"");}
  399. function countRegexMatches(regex,content)
  400. {var text=content;var result=0;var match;while(text&&(match=regex.exec(text))){if(match[0].length>0)
  401. ++result;text=text.substring(match.index+1);}
  402. return result;}
  403. function spacesPadding(spacesCount)
  404. {return Array(spacesCount).join("\u00a0");}
  405. function numberToStringWithSpacesPadding(value,symbolsCount)
  406. {var numberString=value.toString();var paddingLength=Math.max(0,symbolsCount-numberString.length);return spacesPadding(paddingLength)+numberString;}
  407. Array.from=function(iterator)
  408. {var values=[];for(var iteratorValue=iterator.next();!iteratorValue.done;iteratorValue=iterator.next())
  409. values.push(iteratorValue.value);return values;}
  410. Set.fromArray=function(array)
  411. {return new Set(array);}
  412. Set.prototype.valuesArray=function()
  413. {return Array.from(this.values());}
  414. Set.prototype.remove=Set.prototype.delete;Map.prototype.remove=function(key)
  415. {var value=this.get(key);this.delete(key);return value;}
  416. Map.prototype.valuesArray=function()
  417. {return Array.from(this.values());}
  418. Map.prototype.keysArray=function()
  419. {return Array.from(this.keys());}
  420. var StringMultimap=function()
  421. {this._map=new Map();}
  422. StringMultimap.prototype={set:function(key,value)
  423. {var set=this._map.get(key);if(!set){set=new Set();this._map.set(key,set);}
  424. set.add(value);},get:function(key)
  425. {var result=this._map.get(key);if(!result)
  426. result=new Set();return result;},remove:function(key,value)
  427. {var values=this.get(key);values.remove(value);if(!values.size)
  428. this._map.remove(key);},removeAll:function(key)
  429. {this._map.remove(key);},keysArray:function()
  430. {return this._map.keysArray();},valuesArray:function()
  431. {var result=[];var keys=this.keysArray();for(var i=0;i<keys.length;++i)
  432. result.pushAll(this.get(keys[i]).valuesArray());return result;},clear:function()
  433. {this._map.clear();}}
  434. function loadXHR(url)
  435. {return new Promise(load);function load(successCallback,failureCallback)
  436. {function onReadyStateChanged()
  437. {if(xhr.readyState!==XMLHttpRequest.DONE)
  438. return;if(xhr.status!==200){xhr.onreadystatechange=null;failureCallback(new Error(xhr.status));return;}
  439. xhr.onreadystatechange=null;successCallback(xhr.responseText);}
  440. var xhr=new XMLHttpRequest();xhr.open("GET",url,true);xhr.onreadystatechange=onReadyStateChanged;xhr.send(null);}}
  441. function CallbackBarrier()
  442. {this._pendingIncomingCallbacksCount=0;}
  443. CallbackBarrier.prototype={createCallback:function(userCallback)
  444. {console.assert(!this._outgoingCallback,"CallbackBarrier.createCallback() is called after CallbackBarrier.callWhenDone()");++this._pendingIncomingCallbacksCount;return this._incomingCallback.bind(this,userCallback);},callWhenDone:function(callback)
  445. {console.assert(!this._outgoingCallback,"CallbackBarrier.callWhenDone() is called multiple times");this._outgoingCallback=callback;if(!this._pendingIncomingCallbacksCount)
  446. this._outgoingCallback();},_incomingCallback:function(userCallback)
  447. {console.assert(this._pendingIncomingCallbacksCount>0);if(userCallback){var args=Array.prototype.slice.call(arguments,1);userCallback.apply(null,args);}
  448. if(!--this._pendingIncomingCallbacksCount&&this._outgoingCallback)
  449. this._outgoingCallback();}}
  450. function suppressUnused(value)
  451. {}
  452. self.setImmediate=function(callback)
  453. {Promise.resolve().then(callback);return 0;}
  454. Promise.prototype.spread=function(callback)
  455. {return this.then(spreadPromise);function spreadPromise(arg)
  456. {return callback.apply(null,arg);}};Node.prototype.rangeOfWord=function(offset,stopCharacters,stayWithinNode,direction)
  457. {var startNode;var startOffset=0;var endNode;var endOffset=0;if(!stayWithinNode)
  458. stayWithinNode=this;if(!direction||direction==="backward"||direction==="both"){var node=this;while(node){if(node===stayWithinNode){if(!startNode)
  459. startNode=stayWithinNode;break;}
  460. if(node.nodeType===Node.TEXT_NODE){var start=(node===this?(offset-1):(node.nodeValue.length-1));for(var i=start;i>=0;--i){if(stopCharacters.indexOf(node.nodeValue[i])!==-1){startNode=node;startOffset=i+1;break;}}}
  461. if(startNode)
  462. break;node=node.traversePreviousNode(stayWithinNode);}
  463. if(!startNode){startNode=stayWithinNode;startOffset=0;}}else{startNode=this;startOffset=offset;}
  464. if(!direction||direction==="forward"||direction==="both"){node=this;while(node){if(node===stayWithinNode){if(!endNode)
  465. endNode=stayWithinNode;break;}
  466. if(node.nodeType===Node.TEXT_NODE){var start=(node===this?offset:0);for(var i=start;i<node.nodeValue.length;++i){if(stopCharacters.indexOf(node.nodeValue[i])!==-1){endNode=node;endOffset=i;break;}}}
  467. if(endNode)
  468. break;node=node.traverseNextNode(stayWithinNode);}
  469. if(!endNode){endNode=stayWithinNode;endOffset=stayWithinNode.nodeType===Node.TEXT_NODE?stayWithinNode.nodeValue.length:stayWithinNode.childNodes.length;}}else{endNode=this;endOffset=offset;}
  470. var result=this.ownerDocument.createRange();result.setStart(startNode,startOffset);result.setEnd(endNode,endOffset);return result;}
  471. Node.prototype.traverseNextTextNode=function(stayWithin)
  472. {var node=this.traverseNextNode(stayWithin);if(!node)
  473. return null;while(node&&node.nodeType!==Node.TEXT_NODE)
  474. node=node.traverseNextNode(stayWithin);return node;}
  475. Node.prototype.rangeBoundaryForOffset=function(offset)
  476. {var node=this.traverseNextTextNode(this);while(node&&offset>node.nodeValue.length){offset-=node.nodeValue.length;node=node.traverseNextTextNode(this);}
  477. if(!node)
  478. return{container:this,offset:0};return{container:node,offset:offset};}
  479. Element.prototype.positionAt=function(x,y,relativeTo)
  480. {var shift={x:0,y:0};if(relativeTo)
  481. shift=relativeTo.boxInWindow(this.ownerDocument.defaultView);if(typeof x==="number")
  482. this.style.setProperty("left",(shift.x+x)+"px");else
  483. this.style.removeProperty("left");if(typeof y==="number")
  484. this.style.setProperty("top",(shift.y+y)+"px");else
  485. this.style.removeProperty("top");}
  486. Element.prototype.isScrolledToBottom=function()
  487. {return Math.abs(this.scrollTop+this.clientHeight-this.scrollHeight)<=1;}
  488. function removeSubsequentNodes(fromNode,toNode)
  489. {for(var node=fromNode;node&&node!==toNode;){var nodeToRemove=node;node=node.nextSibling;nodeToRemove.remove();}}
  490. Element.prototype.containsEventPoint=function(event)
  491. {var box=this.getBoundingClientRect();return box.left<event.x&&event.x<box.right&&box.top<event.y&&event.y<box.bottom;}
  492. Node.prototype.enclosingNodeOrSelfWithNodeNameInArray=function(nameArray)
  493. {for(var node=this;node&&node!==this.ownerDocument;node=node.parentNodeOrShadowHost()){for(var i=0;i<nameArray.length;++i){if(node.nodeName.toLowerCase()===nameArray[i].toLowerCase())
  494. return node;}}
  495. return null;}
  496. Node.prototype.enclosingNodeOrSelfWithNodeName=function(nodeName)
  497. {return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);}
  498. Node.prototype.enclosingNodeOrSelfWithClass=function(className,stayWithin)
  499. {for(var node=this;node&&node!==stayWithin&&node!==this.ownerDocument;node=node.parentNodeOrShadowHost()){if(node.nodeType===Node.ELEMENT_NODE&&node.classList.contains(className))
  500. return(node);}
  501. return null;}
  502. Node.prototype.parentElementOrShadowHost=function()
  503. {var node=this.parentNode;if(!node)
  504. return null;if(node.nodeType===Node.ELEMENT_NODE)
  505. return(node);if(node.nodeType===Node.DOCUMENT_FRAGMENT_NODE)
  506. return(node.host);return null;}
  507. Node.prototype.parentNodeOrShadowHost=function()
  508. {return this.parentNode||this.host||null;}
  509. Node.prototype.window=function()
  510. {return this.ownerDocument.defaultView;}
  511. Element.prototype.query=function(query)
  512. {return this.ownerDocument.evaluate(query,this,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}
  513. Element.prototype.removeChildren=function()
  514. {if(this.firstChild)
  515. this.textContent="";}
  516. Element.prototype.isInsertionCaretInside=function()
  517. {var selection=this.window().getSelection();if(!selection.rangeCount||!selection.isCollapsed)
  518. return false;var selectionRange=selection.getRangeAt(0);return selectionRange.startContainer.isSelfOrDescendant(this);}
  519. function createElement(tagName,customElementType)
  520. {return document.createElement(tagName,customElementType||"");}
  521. function createTextNode(data)
  522. {return document.createTextNode(data);}
  523. Document.prototype.createElementWithClass=function(elementName,className,customElementType)
  524. {var element=this.createElement(elementName,customElementType||"");if(className)
  525. element.className=className;return element;}
  526. function createElementWithClass(elementName,className,customElementType)
  527. {return document.createElementWithClass(elementName,className,customElementType);}
  528. function createDocumentFragment()
  529. {return document.createDocumentFragment();}
  530. Element.prototype.createChild=function(elementName,className,customElementType)
  531. {var element=this.ownerDocument.createElementWithClass(elementName,className,customElementType);this.appendChild(element);return element;}
  532. DocumentFragment.prototype.createChild=Element.prototype.createChild;Element.prototype.createTextChild=function(text)
  533. {var element=this.ownerDocument.createTextNode(text);this.appendChild(element);return element;}
  534. DocumentFragment.prototype.createTextChild=Element.prototype.createTextChild;Element.prototype.createTextChildren=function(var_args)
  535. {for(var i=0,n=arguments.length;i<n;++i)
  536. this.createTextChild(arguments[i]);}
  537. DocumentFragment.prototype.createTextChildren=Element.prototype.createTextChildren;Element.prototype.appendChildren=function(var_args)
  538. {for(var i=0,n=arguments.length;i<n;++i)
  539. this.appendChild(arguments[i]);}
  540. Element.prototype.totalOffsetLeft=function()
  541. {return this.totalOffset().left;}
  542. Element.prototype.totalOffsetTop=function()
  543. {return this.totalOffset().top;}
  544. Element.prototype.totalOffset=function()
  545. {var rect=this.getBoundingClientRect();return{left:rect.left,top:rect.top};}
  546. Element.prototype.scrollOffset=function()
  547. {var curLeft=0;var curTop=0;for(var element=this;element;element=element.scrollParent){curLeft+=element.scrollLeft;curTop+=element.scrollTop;}
  548. return{left:curLeft,top:curTop};}
  549. function AnchorBox(x,y,width,height)
  550. {this.x=x||0;this.y=y||0;this.width=width||0;this.height=height||0;}
  551. AnchorBox.prototype.relativeTo=function(box)
  552. {return new AnchorBox(this.x-box.x,this.y-box.y,this.width,this.height);}
  553. AnchorBox.prototype.relativeToElement=function(element)
  554. {return this.relativeTo(element.boxInWindow(element.ownerDocument.defaultView));}
  555. AnchorBox.prototype.equals=function(anchorBox)
  556. {return!!anchorBox&&this.x===anchorBox.x&&this.y===anchorBox.y&&this.width===anchorBox.width&&this.height===anchorBox.height;}
  557. Element.prototype.offsetRelativeToWindow=function(targetWindow)
  558. {var elementOffset=new AnchorBox();var curElement=this;var curWindow=this.ownerDocument.defaultView;while(curWindow&&curElement){elementOffset.x+=curElement.totalOffsetLeft();elementOffset.y+=curElement.totalOffsetTop();if(curWindow===targetWindow)
  559. break;curElement=curWindow.frameElement;curWindow=curWindow.parent;}
  560. return elementOffset;}
  561. Element.prototype.boxInWindow=function(targetWindow)
  562. {targetWindow=targetWindow||this.ownerDocument.defaultView;var anchorBox=this.offsetRelativeToWindow(window);anchorBox.width=Math.min(this.offsetWidth,window.innerWidth-anchorBox.x);anchorBox.height=Math.min(this.offsetHeight,window.innerHeight-anchorBox.y);return anchorBox;}
  563. Element.prototype.setTextAndTitle=function(text)
  564. {this.textContent=text;this.title=text;}
  565. KeyboardEvent.prototype.__defineGetter__("data",function()
  566. {switch(this.type){case"keypress":if(!this.ctrlKey&&!this.metaKey)
  567. return String.fromCharCode(this.charCode);else
  568. return"";case"keydown":case"keyup":if(!this.ctrlKey&&!this.metaKey&&!this.altKey)
  569. return String.fromCharCode(this.which);else
  570. return"";}});Event.prototype.consume=function(preventDefault)
  571. {this.stopImmediatePropagation();if(preventDefault)
  572. this.preventDefault();this.handled=true;}
  573. Text.prototype.select=function(start,end)
  574. {start=start||0;end=end||this.textContent.length;if(start<0)
  575. start=end+start;var selection=this.ownerDocument.defaultView.getSelection();selection.removeAllRanges();var range=this.ownerDocument.createRange();range.setStart(this,start);range.setEnd(this,end);selection.addRange(range);return this;}
  576. Element.prototype.selectionLeftOffset=function()
  577. {var selection=this.window().getSelection();if(!selection.containsNode(this,true))
  578. return null;var leftOffset=selection.anchorOffset;var node=selection.anchorNode;while(node!==this){while(node.previousSibling){node=node.previousSibling;leftOffset+=node.textContent.length;}
  579. node=node.parentNodeOrShadowHost();}
  580. return leftOffset;}
  581. Node.prototype.deepTextContent=function()
  582. {var node=this.traverseNextTextNode(this);var result=[];var nonTextTags={"STYLE":1,"SCRIPT":1};while(node){if(!nonTextTags[node.parentElement.nodeName])
  583. result.push(node.textContent);node=node.traverseNextTextNode(this);}
  584. return result.join("");}
  585. Node.prototype.isAncestor=function(node)
  586. {if(!node)
  587. return false;var currentNode=node.parentNodeOrShadowHost();while(currentNode){if(this===currentNode)
  588. return true;currentNode=currentNode.parentNodeOrShadowHost();}
  589. return false;}
  590. Node.prototype.isDescendant=function(descendant)
  591. {return!!descendant&&descendant.isAncestor(this);}
  592. Node.prototype.isSelfOrAncestor=function(node)
  593. {return!!node&&(node===this||this.isAncestor(node));}
  594. Node.prototype.isSelfOrDescendant=function(node)
  595. {return!!node&&(node===this||this.isDescendant(node));}
  596. Node.prototype.traverseNextNode=function(stayWithin)
  597. {if(this.firstChild)
  598. return this.firstChild;if(this.shadowRoot)
  599. return this.shadowRoot;if(stayWithin&&this===stayWithin)
  600. return null;var node=this.nextSibling;if(node)
  601. return node;node=this;while(node&&!node.nextSibling&&(!stayWithin||!node.parentNodeOrShadowHost()||node.parentNodeOrShadowHost()!==stayWithin))
  602. node=node.parentNodeOrShadowHost();if(!node)
  603. return null;return node.nextSibling;}
  604. Node.prototype.traversePreviousNode=function(stayWithin)
  605. {if(stayWithin&&this===stayWithin)
  606. return null;var node=this.previousSibling;while(node&&node.lastChild)
  607. node=node.lastChild;if(node)
  608. return node;return this.parentNodeOrShadowHost();}
  609. Node.prototype.setTextContentTruncatedIfNeeded=function(text,placeholder)
  610. {const maxTextContentLength=65535;if(typeof text==="string"&&text.length>maxTextContentLength){this.textContent=typeof placeholder==="string"?placeholder:text.trimEnd(maxTextContentLength);return true;}
  611. this.textContent=text;return false;}
  612. Event.prototype.deepElementFromPoint=function()
  613. {var node=this.target;while(node&&node.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&node.nodeType!==Node.DOCUMENT_NODE)
  614. node=node.parentNode;if(!node)
  615. return null;node=node.elementFromPoint(this.pageX,this.pageY);while(node&&node.shadowRoot)
  616. node=node.shadowRoot.elementFromPoint(this.pageX,this.pageY);return node;}
  617. Document.prototype.deepElementFromPoint=function(x,y)
  618. {var node=this.elementFromPoint(x,y);while(node&&node.shadowRoot)
  619. node=node.shadowRoot.elementFromPoint(x,y);return node;}
  620. function isEnterKey(event){return event.keyCode!==229&&event.keyIdentifier==="Enter";}
  621. function consumeEvent(e)
  622. {e.consume();}
  623. function runOnWindowLoad(callback)
  624. {function windowLoaded()
  625. {window.removeEventListener("DOMContentLoaded",windowLoaded,false);callback();}
  626. if(document.readyState==="complete"||document.readyState==="interactive")
  627. callback();else
  628. window.addEventListener("DOMContentLoaded",windowLoaded,false);};var WorkerRuntime={};WorkerRuntime.startSharedWorker=function(moduleName,workerName)
  629. {if(Runtime.isReleaseMode()){try{var worker=new SharedWorker(moduleName+"_module.js",workerName);return Promise.resolve(worker);}catch(e){return Promise.reject(e);}}
  630. return loadResourcePromise(moduleName+"/module.json").then(start,start.bind(null,undefined));function start(content)
  631. {if(!content)
  632. throw new Error("Worker is not defined: "+moduleName+" "+new Error().stack);var scripts=JSON.parse(content)["scripts"];if(scripts.length!==1)
  633. throw new Error("WorkerRuntime.startSharedWorker supports modules with only one script!");return new SharedWorker(moduleName+"/"+scripts[0],workerName);}}
  634. WorkerRuntime.startWorker=function(moduleName)
  635. {if(Runtime.isReleaseMode())
  636. return Promise.resolve(new Worker(moduleName+"_module.js"));var loader=function(){self.onmessage=function(event){self.onmessage=null;var scripts=event.data;for(var i=0;i<scripts.length;++i){var source=scripts[i]["source"];self.eval(source+"\n//# sourceURL="+scripts[i]["url"]);}};};return loadResourcePromise(moduleName+"/module.json").then(start,start.bind(null,undefined));function start(content)
  637. {if(!content)
  638. throw new Error("Worker is not defined: "+moduleName+" "+new Error().stack);var message=[];var scripts=JSON.parse(content)["scripts"];var promise=Promise.resolve();for(var i=0;i<scripts.length;++i){var url=self._importScriptPathPrefix+moduleName+"/"+scripts[i];var parts=url.split("://");url=parts.length===1?url:parts[0]+"://"+normalizePath(parts[1]);promise=promise.then(promiseGetter(loadResourcePromise(moduleName+"/"+scripts[i]))).then(pushSource.bind(null,url),pushSource.bind(null,null,null));}
  639. return promise.then(createWorker);function promiseGetter(promise)
  640. {return function(){return promise;};}
  641. function pushSource(url,source)
  642. {if(!url){console.error("Failed to load "+url);return;}
  643. message.push({source:source,url:url});}
  644. function createWorker()
  645. {var blob=new Blob(["("+loader.toString()+")()\n//# sourceURL="+moduleName],{type:"text/javascript"});var workerURL=window.URL.createObjectURL(blob);try{var worker=new Worker(workerURL);worker.postMessage(message);return worker;}finally{window.URL.revokeObjectURL(workerURL);}}}}
  646. WorkerRuntime.Worker=function(moduleName,workerName)
  647. {this._isSharedWorker=!!workerName;this._workerPromise=workerName?WorkerRuntime.startSharedWorker(moduleName,(workerName)):WorkerRuntime.startWorker(moduleName);}
  648. WorkerRuntime.Worker.prototype={postMessage:function(message)
  649. {this._workerPromise.then(postToWorker.bind(this));function postToWorker(worker)
  650. {if(!this._disposed)
  651. worker.postMessage(message);}},dispose:function()
  652. {this._disposed=true;this._workerPromise.then(terminate);function terminate(worker)
  653. {worker.terminate();}},terminate:function()
  654. {this.dispose();},set onmessage(listener)
  655. {this._workerPromise.then(setOnMessage);function setOnMessage(worker)
  656. {worker.onmessage=listener;}},set onerror(listener)
  657. {this._workerPromise.then(setOnError);function setOnError(worker)
  658. {worker.onerror=listener;}},get port()
  659. {return new WorkerRuntime.Worker.FuturePort(this);}}
  660. WorkerRuntime.Worker.FuturePort=function(worker)
  661. {this._worker=worker;}
  662. WorkerRuntime.Worker.FuturePort.prototype={set onmessage(listener)
  663. {this._worker._workerPromise.then(setOnMessage);function setOnMessage(worker)
  664. {worker.port.onmessage=listener;}},set onerror(listener)
  665. {this._worker._workerPromise.then(setOnError);function setOnError(worker)
  666. {worker.port.onerror=listener;}}};self.WebInspector={};WebInspector.Object=function(){}
  667. WebInspector.Object.prototype={addEventListener:function(eventType,listener,thisObject)
  668. {if(!listener)
  669. console.assert(false);if(!this._listeners)
  670. this._listeners=new Map();if(!this._listeners.has(eventType))
  671. this._listeners.set(eventType,[]);this._listeners.get(eventType).push({thisObject:thisObject,listener:listener});},removeEventListener:function(eventType,listener,thisObject)
  672. {console.assert(listener);if(!this._listeners||!this._listeners.has(eventType))
  673. return;var listeners=this._listeners.get(eventType);for(var i=0;i<listeners.length;++i){if(listeners[i].listener===listener&&listeners[i].thisObject===thisObject)
  674. listeners.splice(i--,1);}
  675. if(!listeners.length)
  676. this._listeners.delete(eventType);},removeAllListeners:function()
  677. {delete this._listeners;},hasEventListeners:function(eventType)
  678. {if(!this._listeners||!this._listeners.has(eventType))
  679. return false;return true;},dispatchEventToListeners:function(eventType,eventData)
  680. {if(!this._listeners||!this._listeners.has(eventType))
  681. return false;var event=new WebInspector.Event(this,eventType,eventData);var listeners=this._listeners.get(eventType).slice(0);for(var i=0;i<listeners.length;++i){listeners[i].listener.call(listeners[i].thisObject,event);if(event._stoppedPropagation)
  682. break;}
  683. return event.defaultPrevented;}}
  684. WebInspector.Event=function(target,type,data)
  685. {this.target=target;this.type=type;this.data=data;this.defaultPrevented=false;this._stoppedPropagation=false;}
  686. WebInspector.Event.prototype={stopPropagation:function()
  687. {this._stoppedPropagation=true;},preventDefault:function()
  688. {this.defaultPrevented=true;},consume:function(preventDefault)
  689. {this.stopPropagation();if(preventDefault)
  690. this.preventDefault();}}
  691. WebInspector.EventTarget=function()
  692. {}
  693. WebInspector.EventTarget.prototype={addEventListener:function(eventType,listener,thisObject){},removeEventListener:function(eventType,listener,thisObject){},removeAllListeners:function(){},hasEventListeners:function(eventType){},dispatchEventToListeners:function(eventType,eventData){},};WebInspector.NotificationService=function(){}
  694. WebInspector.NotificationService.prototype={__proto__:WebInspector.Object.prototype}
  695. WebInspector.NotificationService.Events={InspectorAgentEnabledForTests:"InspectorAgentEnabledForTests",SelectedNodeChanged:"SelectedNodeChanged"}
  696. WebInspector.notifications=new WebInspector.NotificationService();;WebInspector.Color=function(rgba,format,originalText)
  697. {this._rgba=rgba;this._originalText=originalText||null;this._format=format||null;if(typeof this._rgba[3]==="undefined")
  698. this._rgba[3]=1;for(var i=0;i<4;++i){if(this._rgba[i]<0)
  699. this._rgba[i]=0;if(this._rgba[i]>1)
  700. this._rgba[i]=1;}}
  701. WebInspector.Color.parse=function(text)
  702. {var value=text.toLowerCase().replace(/\s+/g,"");var simple=/^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;var match=value.match(simple);if(match){if(match[1]){var hex=match[1].toUpperCase();var format;if(hex.length===3){format=WebInspector.Color.Format.ShortHEX;hex=hex.charAt(0)+hex.charAt(0)+hex.charAt(1)+hex.charAt(1)+hex.charAt(2)+hex.charAt(2);}else
  703. format=WebInspector.Color.Format.HEX;var r=parseInt(hex.substring(0,2),16);var g=parseInt(hex.substring(2,4),16);var b=parseInt(hex.substring(4,6),16);return new WebInspector.Color([r/255,g/255,b/255,1],format,text);}
  704. if(match[2]){var rgbString=match[2].split(/\s*,\s*/);var rgba=[WebInspector.Color._parseRgbNumeric(rgbString[0]),WebInspector.Color._parseRgbNumeric(rgbString[1]),WebInspector.Color._parseRgbNumeric(rgbString[2]),1];return new WebInspector.Color(rgba,WebInspector.Color.Format.RGB,text);}
  705. if(match[3]){var nickname=match[3].toLowerCase();if(nickname in WebInspector.Color.Nicknames){var rgba=WebInspector.Color.Nicknames[nickname];var color=WebInspector.Color.fromRGBA(rgba);color._format=WebInspector.Color.Format.Nickname;color._originalText=nickname;return color;}
  706. return null;}
  707. if(match[4]){var hslString=match[4].replace(/%/g,"").split(/\s*,\s*/);var hsla=[WebInspector.Color._parseHueNumeric(hslString[0]),WebInspector.Color._parseSatLightNumeric(hslString[1]),WebInspector.Color._parseSatLightNumeric(hslString[2]),1];var rgba=WebInspector.Color._hsl2rgb(hsla);return new WebInspector.Color(rgba,WebInspector.Color.Format.HSL,text);}
  708. return null;}
  709. var advanced=/^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;match=value.match(advanced);if(match){if(match[1]){var rgbaString=match[1].split(/\s*,\s*/);var rgba=[WebInspector.Color._parseRgbNumeric(rgbaString[0]),WebInspector.Color._parseRgbNumeric(rgbaString[1]),WebInspector.Color._parseRgbNumeric(rgbaString[2]),WebInspector.Color._parseAlphaNumeric(rgbaString[3])];return new WebInspector.Color(rgba,WebInspector.Color.Format.RGBA,text);}
  710. if(match[2]){var hslaString=match[2].replace(/%/g,"").split(/\s*,\s*/);var hsla=[WebInspector.Color._parseHueNumeric(hslaString[0]),WebInspector.Color._parseSatLightNumeric(hslaString[1]),WebInspector.Color._parseSatLightNumeric(hslaString[2]),WebInspector.Color._parseAlphaNumeric(hslaString[3])];var rgba=WebInspector.Color._hsl2rgb(hsla);return new WebInspector.Color(rgba,WebInspector.Color.Format.HSLA,text);}}
  711. return null;}
  712. WebInspector.Color.fromRGBA=function(rgba)
  713. {return new WebInspector.Color([rgba[0]/255,rgba[1]/255,rgba[2]/255,rgba[3]]);}
  714. WebInspector.Color.fromHSVA=function(hsva)
  715. {var h=hsva[0];var s=hsva[1];var v=hsva[2];var t=(2-s)*v;if(v===0||s===0)
  716. s=0;else
  717. s*=v/(t<1?t:2-t);var hsla=[h,s,t/2,hsva[3]];return new WebInspector.Color(WebInspector.Color._hsl2rgb(hsla),WebInspector.Color.Format.HSLA);}
  718. WebInspector.Color.prototype={format:function()
  719. {return this._format;},hsla:function()
  720. {if(this._hsla)
  721. return this._hsla;var r=this._rgba[0];var g=this._rgba[1];var b=this._rgba[2];var max=Math.max(r,g,b);var min=Math.min(r,g,b);var diff=max-min;var add=max+min;if(min===max)
  722. var h=0;else if(r===max)
  723. var h=((1/6*(g-b)/diff)+1)%1;else if(g===max)
  724. var h=(1/6*(b-r)/diff)+1/3;else
  725. var h=(1/6*(r-g)/diff)+2/3;var l=0.5*add;if(l===0)
  726. var s=0;else if(l===1)
  727. var s=1;else if(l<=0.5)
  728. var s=diff/add;else
  729. var s=diff/(2-add);this._hsla=[h,s,l,this._rgba[3]];return this._hsla;},hsva:function()
  730. {var hsla=this.hsla();var h=hsla[0];var s=hsla[1];var l=hsla[2];s*=l<0.5?l:1-l;return[h,s!==0?2*s/(l+s):0,(l+s),hsla[3]];},hasAlpha:function()
  731. {return this._rgba[3]!==1;},canBeShortHex:function()
  732. {if(this.hasAlpha())
  733. return false;for(var i=0;i<3;++i){var c=Math.round(this._rgba[i]*255);if(c%17)
  734. return false;}
  735. return true;},asString:function(format)
  736. {if(!format)
  737. format=this._format;function toRgbValue(value)
  738. {return Math.round(value*255);}
  739. function toHexValue(value)
  740. {var hex=Math.round(value*255).toString(16);return hex.length===1?"0"+hex:hex;}
  741. function toShortHexValue(value)
  742. {return(Math.round(value*255)/17).toString(16);}
  743. switch(format){case WebInspector.Color.Format.Original:return this._originalText;case WebInspector.Color.Format.RGB:if(this.hasAlpha())
  744. return null;return String.sprintf("rgb(%d, %d, %d)",toRgbValue(this._rgba[0]),toRgbValue(this._rgba[1]),toRgbValue(this._rgba[2]));case WebInspector.Color.Format.RGBA:return String.sprintf("rgba(%d, %d, %d, %f)",toRgbValue(this._rgba[0]),toRgbValue(this._rgba[1]),toRgbValue(this._rgba[2]),this._rgba[3]);case WebInspector.Color.Format.HSL:if(this.hasAlpha())
  745. return null;var hsl=this.hsla();return String.sprintf("hsl(%d, %d%, %d%)",Math.round(hsl[0]*360),Math.round(hsl[1]*100),Math.round(hsl[2]*100));case WebInspector.Color.Format.HSLA:var hsla=this.hsla();return String.sprintf("hsla(%d, %d%, %d%, %f)",Math.round(hsla[0]*360),Math.round(hsla[1]*100),Math.round(hsla[2]*100),hsla[3]);case WebInspector.Color.Format.HEX:if(this.hasAlpha())
  746. return null;return String.sprintf("#%s%s%s",toHexValue(this._rgba[0]),toHexValue(this._rgba[1]),toHexValue(this._rgba[2])).toUpperCase();case WebInspector.Color.Format.ShortHEX:if(!this.canBeShortHex())
  747. return null;return String.sprintf("#%s%s%s",toShortHexValue(this._rgba[0]),toShortHexValue(this._rgba[1]),toShortHexValue(this._rgba[2])).toUpperCase();case WebInspector.Color.Format.Nickname:return this.nickname();}
  748. return this._originalText;},_canonicalRGBA:function()
  749. {var rgba=new Array(3);for(var i=0;i<3;++i)
  750. rgba[i]=Math.round(this._rgba[i]*255);if(this._rgba[3]!==1)
  751. rgba.push(this._rgba[3]);return rgba;},nickname:function()
  752. {if(!WebInspector.Color._rgbaToNickname){WebInspector.Color._rgbaToNickname={};for(var nickname in WebInspector.Color.Nicknames){var rgba=WebInspector.Color.Nicknames[nickname];WebInspector.Color._rgbaToNickname[rgba]=nickname;}}
  753. return WebInspector.Color._rgbaToNickname[this._canonicalRGBA()]||null;},toProtocolRGBA:function()
  754. {var rgba=this._canonicalRGBA();var result={r:rgba[0],g:rgba[1],b:rgba[2]};if(rgba[3]!==1)
  755. result.a=rgba[3];return result;},invert:function()
  756. {var rgba=[];rgba[0]=1-this._rgba[0];rgba[1]=1-this._rgba[1];rgba[2]=1-this._rgba[2];rgba[3]=this._rgba[3];return new WebInspector.Color(rgba);},setAlpha:function(alpha)
  757. {var rgba=this._rgba.slice();rgba[3]=alpha;return new WebInspector.Color(rgba);}}
  758. WebInspector.Color._parseRgbNumeric=function(value)
  759. {var parsed=parseInt(value,10);if(value.indexOf("%")!==-1)
  760. parsed/=100;else
  761. parsed/=255;return parsed;}
  762. WebInspector.Color._parseHueNumeric=function(value)
  763. {return isNaN(value)?0:(parseFloat(value)/360)%1;}
  764. WebInspector.Color._parseSatLightNumeric=function(value)
  765. {return parseFloat(value)/100;}
  766. WebInspector.Color._parseAlphaNumeric=function(value)
  767. {return isNaN(value)?0:parseFloat(value);}
  768. WebInspector.Color._hsl2rgb=function(hsl)
  769. {var h=hsl[0];var s=hsl[1];var l=hsl[2];function hue2rgb(p,q,h)
  770. {if(h<0)
  771. h+=1;else if(h>1)
  772. h-=1;if((h*6)<1)
  773. return p+(q-p)*h*6;else if((h*2)<1)
  774. return q;else if((h*3)<2)
  775. return p+(q-p)*((2/3)-h)*6;else
  776. return p;}
  777. if(s<0)
  778. s=0;if(l<=0.5)
  779. var q=l*(1+s);else
  780. var q=l+s-(l*s);var p=2*l-q;var tr=h+(1/3);var tg=h;var tb=h-(1/3);var r=hue2rgb(p,q,tr);var g=hue2rgb(p,q,tg);var b=hue2rgb(p,q,tb);return[r,g,b,hsl[3]];}
  781. WebInspector.Color.Nicknames={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[237,20,61],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgrey":[169,169,169],"darkgreen":[0,100,0],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"grey":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgreen":[144,238,144],"lightgray":[211,211,211],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50],"transparent":[0,0,0,0],};WebInspector.Color.PageHighlight={Content:WebInspector.Color.fromRGBA([111,168,220,.66]),ContentLight:WebInspector.Color.fromRGBA([111,168,220,.5]),ContentOutline:WebInspector.Color.fromRGBA([9,83,148]),Padding:WebInspector.Color.fromRGBA([147,196,125,.55]),PaddingLight:WebInspector.Color.fromRGBA([147,196,125,.4]),Border:WebInspector.Color.fromRGBA([255,229,153,.66]),BorderLight:WebInspector.Color.fromRGBA([255,229,153,.5]),Margin:WebInspector.Color.fromRGBA([246,178,107,.66]),MarginLight:WebInspector.Color.fromRGBA([246,178,107,.5]),EventTarget:WebInspector.Color.fromRGBA([255,196,196,.66]),Shape:WebInspector.Color.fromRGBA([96,82,177,0.8]),ShapeMargin:WebInspector.Color.fromRGBA([96,82,127,.6])}
  782. WebInspector.Color.Format={Original:"original",Nickname:"nickname",HEX:"hex",ShortHEX:"shorthex",RGB:"rgb",RGBA:"rgba",HSL:"hsl",HSLA:"hsla"};WebInspector.Geometry={};WebInspector.Geometry._Eps=1e-5;WebInspector.Geometry.Vector=function(x,y,z)
  783. {this.x=x;this.y=y;this.z=z;}
  784. WebInspector.Geometry.Vector.prototype={length:function()
  785. {return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);},normalize:function()
  786. {var length=this.length();if(length<=WebInspector.Geometry._Eps)
  787. return;this.x/=length;this.y/=length;this.z/=length;}}
  788. WebInspector.Geometry.EulerAngles=function(alpha,beta,gamma)
  789. {this.alpha=alpha;this.beta=beta;this.gamma=gamma;}
  790. WebInspector.Geometry.EulerAngles.fromRotationMatrix=function(rotationMatrix)
  791. {var beta=Math.atan2(rotationMatrix.m23,rotationMatrix.m33);var gamma=Math.atan2(-rotationMatrix.m13,Math.sqrt(rotationMatrix.m11*rotationMatrix.m11+rotationMatrix.m12*rotationMatrix.m12));var alpha=Math.atan2(rotationMatrix.m12,rotationMatrix.m11);return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radToDeg(alpha),WebInspector.Geometry.radToDeg(beta),WebInspector.Geometry.radToDeg(gamma));}
  792. WebInspector.Geometry.scalarProduct=function(u,v)
  793. {return u.x*v.x+u.y*v.y+u.z*v.z;}
  794. WebInspector.Geometry.crossProduct=function(u,v)
  795. {var x=u.y*v.z-u.z*v.y;var y=u.z*v.x-u.x*v.z;var z=u.x*v.y-u.y*v.x;return new WebInspector.Geometry.Vector(x,y,z);}
  796. WebInspector.Geometry.subtract=function(u,v)
  797. {var x=u.x-v.x;var y=u.y-v.y;var z=u.z-v.z;return new WebInspector.Geometry.Vector(x,y,z);}
  798. WebInspector.Geometry.multiplyVectorByMatrixAndNormalize=function(v,m)
  799. {var t=v.x*m.m14+v.y*m.m24+v.z*m.m34+m.m44;var x=(v.x*m.m11+v.y*m.m21+v.z*m.m31+m.m41)/t;var y=(v.x*m.m12+v.y*m.m22+v.z*m.m32+m.m42)/t;var z=(v.x*m.m13+v.y*m.m23+v.z*m.m33+m.m43)/t;return new WebInspector.Geometry.Vector(x,y,z);}
  800. WebInspector.Geometry.calculateAngle=function(u,v)
  801. {var uLength=u.length();var vLength=v.length();if(uLength<=WebInspector.Geometry._Eps||vLength<=WebInspector.Geometry._Eps)
  802. return 0;var cos=WebInspector.Geometry.scalarProduct(u,v)/uLength/vLength;if(Math.abs(cos)>1)
  803. return 0;return WebInspector.Geometry.radToDeg(Math.acos(cos));}
  804. WebInspector.Geometry.radToDeg=function(rad)
  805. {return rad*180/Math.PI;}
  806. WebInspector.Geometry.boundsForTransformedPoints=function(matrix,points,aggregateBounds)
  807. {if(!aggregateBounds)
  808. aggregateBounds={minX:Infinity,maxX:-Infinity,minY:Infinity,maxY:-Infinity};if(points.length%3)
  809. console.assert("Invalid size of points array");for(var p=0;p<points.length;p+=3){var vector=new WebInspector.Geometry.Vector(points[p],points[p+1],points[p+2]);vector=WebInspector.Geometry.multiplyVectorByMatrixAndNormalize(vector,matrix);aggregateBounds.minX=Math.min(aggregateBounds.minX,vector.x);aggregateBounds.maxX=Math.max(aggregateBounds.maxX,vector.x);aggregateBounds.minY=Math.min(aggregateBounds.minY,vector.y);aggregateBounds.maxY=Math.max(aggregateBounds.maxY,vector.y);}
  810. return aggregateBounds;}
  811. function Size(width,height)
  812. {this.width=width;this.height=height;}
  813. Size.prototype.isEqual=function(size)
  814. {return!!size&&this.width===size.width&&this.height===size.height;};Size.prototype.widthToMax=function(size)
  815. {return new Size(Math.max(this.width,(typeof size==="number"?size:size.width)),this.height);};Size.prototype.addWidth=function(size)
  816. {return new Size(this.width+(typeof size==="number"?size:size.width),this.height);};Size.prototype.heightToMax=function(size)
  817. {return new Size(this.width,Math.max(this.height,(typeof size==="number"?size:size.height)));};Size.prototype.addHeight=function(size)
  818. {return new Size(this.width,this.height+(typeof size==="number"?size:size.height));};function Constraints(minimum,preferred)
  819. {this.minimum=minimum||new Size(0,0);this.preferred=preferred||this.minimum;if(this.minimum.width>this.preferred.width||this.minimum.height>this.preferred.height)
  820. throw new Error("Minimum size is greater than preferred.");}
  821. Constraints.prototype.isEqual=function(constraints)
  822. {return!!constraints&&this.minimum.isEqual(constraints.minimum)&&this.preferred.isEqual(constraints.preferred);}
  823. Constraints.prototype.widthToMax=function(value)
  824. {if(typeof value==="number")
  825. return new Constraints(this.minimum.widthToMax(value),this.preferred.widthToMax(value));return new Constraints(this.minimum.widthToMax(value.minimum),this.preferred.widthToMax(value.preferred));}
  826. Constraints.prototype.addWidth=function(value)
  827. {if(typeof value==="number")
  828. return new Constraints(this.minimum.addWidth(value),this.preferred.addWidth(value));return new Constraints(this.minimum.addWidth(value.minimum),this.preferred.addWidth(value.preferred));}
  829. Constraints.prototype.heightToMax=function(value)
  830. {if(typeof value==="number")
  831. return new Constraints(this.minimum.heightToMax(value),this.preferred.heightToMax(value));return new Constraints(this.minimum.heightToMax(value.minimum),this.preferred.heightToMax(value.preferred));}
  832. Constraints.prototype.addHeight=function(value)
  833. {if(typeof value==="number")
  834. return new Constraints(this.minimum.addHeight(value),this.preferred.addHeight(value));return new Constraints(this.minimum.addHeight(value.minimum),this.preferred.addHeight(value.preferred));};WebInspector.Console=function()
  835. {this._messages=[];}
  836. WebInspector.Console.Events={MessageAdded:"messageAdded"}
  837. WebInspector.Console.MessageLevel={Log:"log",Warning:"warning",Error:"error"}
  838. WebInspector.Console.Message=function(text,level,timestamp,show)
  839. {this.text=text;this.level=level;this.timestamp=(typeof timestamp==="number")?timestamp:Date.now();this.show=show;}
  840. WebInspector.Console.UIDelegate=function()
  841. {}
  842. WebInspector.Console.UIDelegate.prototype={showConsole:function(){}}
  843. WebInspector.Console.prototype={setUIDelegate:function(uiDelegate)
  844. {this._uiDelegate=uiDelegate;},addMessage:function(text,level,show)
  845. {var message=new WebInspector.Console.Message(text,level||WebInspector.Console.MessageLevel.Log,Date.now(),show||false);this._messages.push(message);this.dispatchEventToListeners(WebInspector.Console.Events.MessageAdded,message);},log:function(text)
  846. {this.addMessage(text,WebInspector.Console.MessageLevel.Log);},warn:function(text)
  847. {this.addMessage(text,WebInspector.Console.MessageLevel.Warning);},error:function(text)
  848. {this.addMessage(text,WebInspector.Console.MessageLevel.Error,true);},messages:function()
  849. {return this._messages;},show:function()
  850. {this.showPromise();},showPromise:function()
  851. {if(this._uiDelegate)
  852. return this._uiDelegate.showConsole();return Promise.reject();},__proto__:WebInspector.Object.prototype}
  853. WebInspector.console=new WebInspector.Console();;WebInspector.ContentProvider=function(){}
  854. WebInspector.ContentProvider.prototype={contentURL:function(){},contentType:function(){},requestContent:function(callback){},searchInContent:function(query,caseSensitive,isRegex,callback){}}
  855. WebInspector.ContentProvider.SearchMatch=function(lineNumber,lineContent){this.lineNumber=lineNumber;this.lineContent=lineContent;}
  856. WebInspector.ContentProvider.performSearchInContent=function(content,query,caseSensitive,isRegex)
  857. {var regex=createSearchRegex(query,caseSensitive,isRegex);var contentString=new String(content);var result=[];for(var i=0;i<contentString.lineCount();++i){var lineContent=contentString.lineAt(i);regex.lastIndex=0;if(regex.exec(lineContent))
  858. result.push(new WebInspector.ContentProvider.SearchMatch(i,lineContent));}
  859. return result;};WebInspector.Lock=function()
  860. {this._count=0;}
  861. WebInspector.Lock.Events={StateChanged:"StateChanged"}
  862. WebInspector.Lock.prototype={isAcquired:function()
  863. {return!!this._count;},acquire:function()
  864. {if(++this._count===1)
  865. this.dispatchEventToListeners(WebInspector.Lock.Events.StateChanged);},release:function()
  866. {--this._count;if(this._count<0){console.error("WebInspector.Lock acquire/release calls are unbalanced "+new Error().stack);return;}
  867. if(!this._count)
  868. this.dispatchEventToListeners(WebInspector.Lock.Events.StateChanged);},__proto__:WebInspector.Object.prototype};WebInspector.ParsedURL=function(url)
  869. {this.isValid=false;this.url=url;this.scheme="";this.host="";this.port="";this.path="";this.queryParams="";this.fragment="";this.folderPathComponents="";this.lastPathComponent="";var match=url.match(/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^\s\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);if(match){this.isValid=true;this.scheme=match[1].toLowerCase();this.host=match[2];this.port=match[3];this.path=match[4]||"/";this.fragment=match[5];}else{if(this.url.startsWith("data:")){this.scheme="data";return;}
  870. if(this.url==="about:blank"){this.scheme="about";return;}
  871. this.path=this.url;}
  872. var path=this.path;var indexOfQuery=path.indexOf("?");if(indexOfQuery!==-1){this.queryParams=path.substring(indexOfQuery+1);path=path.substring(0,indexOfQuery);}
  873. var lastSlashIndex=path.lastIndexOf("/");if(lastSlashIndex!==-1){this.folderPathComponents=path.substring(0,lastSlashIndex);this.lastPathComponent=path.substring(lastSlashIndex+1);}else
  874. this.lastPathComponent=path;}
  875. WebInspector.ParsedURL._decodeIfPossible=function(url)
  876. {var decodedURL=url;try{decodedURL=decodeURI(url);}catch(e){}
  877. return decodedURL;}
  878. WebInspector.ParsedURL.splitURLIntoPathComponents=function(url)
  879. {var decodedURL=WebInspector.ParsedURL._decodeIfPossible(url);var parsedURL=new WebInspector.ParsedURL(decodedURL);var origin;var folderPath;var name;if(parsedURL.isValid){origin=parsedURL.scheme+"://"+parsedURL.host;if(parsedURL.port)
  880. origin+=":"+parsedURL.port;folderPath=parsedURL.folderPathComponents;name=parsedURL.lastPathComponent;if(parsedURL.queryParams)
  881. name+="?"+parsedURL.queryParams;}else{origin="";folderPath="";name=url;}
  882. var result=[origin];var splittedPath=folderPath.split("/");for(var i=1;i<splittedPath.length;++i){if(!splittedPath[i])
  883. continue;result.push(splittedPath[i]);}
  884. result.push(name);return result;}
  885. WebInspector.ParsedURL.completeURL=function(baseURL,href)
  886. {if(href){var trimmedHref=href.trim();if(trimmedHref.startsWith("data:")||trimmedHref.startsWith("blob:")||trimmedHref.startsWith("javascript:"))
  887. return href;var parsedHref=trimmedHref.asParsedURL();if(parsedHref&&parsedHref.scheme)
  888. return trimmedHref;}else{return baseURL;}
  889. var parsedURL=baseURL.asParsedURL();if(parsedURL){if(parsedURL.isDataURL())
  890. return href;var path=href;var query=path.indexOf("?");var postfix="";if(query!==-1){postfix=path.substring(query);path=path.substring(0,query);}else{var fragment=path.indexOf("#");if(fragment!==-1){postfix=path.substring(fragment);path=path.substring(0,fragment);}}
  891. if(!path){var basePath=parsedURL.path;if(postfix.charAt(0)==="?"){var baseQuery=parsedURL.path.indexOf("?");if(baseQuery!==-1)
  892. basePath=basePath.substring(0,baseQuery);}
  893. return parsedURL.scheme+"://"+parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"")+basePath+postfix;}else if(path.charAt(0)!=="/"){var prefix=parsedURL.path;var prefixQuery=prefix.indexOf("?");if(prefixQuery!==-1)
  894. prefix=prefix.substring(0,prefixQuery);prefix=prefix.substring(0,prefix.lastIndexOf("/"))+"/";path=prefix+path;}else if(path.length>1&&path.charAt(1)==="/"){return parsedURL.scheme+":"+path+postfix;}
  895. return parsedURL.scheme+"://"+parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"")+normalizePath(path)+postfix;}
  896. return null;}
  897. WebInspector.ParsedURL.prototype={get displayName()
  898. {if(this._displayName)
  899. return this._displayName;if(this.isDataURL())
  900. return this.dataURLDisplayName();if(this.isAboutBlank())
  901. return this.url;this._displayName=this.lastPathComponent;if(!this._displayName)
  902. this._displayName=(this.host||"")+"/";if(this._displayName==="/")
  903. this._displayName=this.url;return this._displayName;},dataURLDisplayName:function()
  904. {if(this._dataURLDisplayName)
  905. return this._dataURLDisplayName;if(!this.isDataURL())
  906. return"";this._dataURLDisplayName=this.url.trimEnd(20);return this._dataURLDisplayName;},isAboutBlank:function()
  907. {return this.url==="about:blank";},isDataURL:function()
  908. {return this.scheme==="data";}}
  909. WebInspector.ParsedURL.splitLineAndColumn=function(string)
  910. {var lineColumnRegEx=/:(\d+)(:(\d+))?$/;var lineColumnMatch=lineColumnRegEx.exec(string);var lineNumber;var columnNumber;if(!lineColumnMatch)
  911. return null;lineNumber=parseInt(lineColumnMatch[1],10);lineNumber=isNaN(lineNumber)?undefined:lineNumber-1;if(typeof(lineColumnMatch[3])==="string"){columnNumber=parseInt(lineColumnMatch[3],10);columnNumber=isNaN(columnNumber)?undefined:columnNumber-1;}
  912. return{url:string.substring(0,string.length-lineColumnMatch[0].length),lineNumber:lineNumber,columnNumber:columnNumber};}
  913. String.prototype.asParsedURL=function()
  914. {var parsedURL=new WebInspector.ParsedURL(this.toString());if(parsedURL.isValid)
  915. return parsedURL;return null;};WebInspector.Progress=function()
  916. {}
  917. WebInspector.Progress.Events={Canceled:"Canceled",Done:"Done"}
  918. WebInspector.Progress.prototype={setTotalWork:function(totalWork){},setTitle:function(title){},setWorked:function(worked,title){},worked:function(worked){},done:function(){},isCanceled:function(){return false;},addEventListener:function(eventType,listener,thisObject){}}
  919. WebInspector.CompositeProgress=function(parent)
  920. {this._parent=parent;this._children=[];this._childrenDone=0;this._parent.setTotalWork(1);this._parent.setWorked(0);parent.addEventListener(WebInspector.Progress.Events.Canceled,this._parentCanceled.bind(this));}
  921. WebInspector.CompositeProgress.prototype={_childDone:function()
  922. {if(++this._childrenDone!==this._children.length)
  923. return;this.dispatchEventToListeners(WebInspector.Progress.Events.Done);this._parent.done();},_parentCanceled:function()
  924. {this.dispatchEventToListeners(WebInspector.Progress.Events.Canceled);for(var i=0;i<this._children.length;++i){this._children[i].dispatchEventToListeners(WebInspector.Progress.Events.Canceled);}},createSubProgress:function(weight)
  925. {var child=new WebInspector.SubProgress(this,weight);this._children.push(child);return child;},_update:function()
  926. {var totalWeights=0;var done=0;for(var i=0;i<this._children.length;++i){var child=this._children[i];if(child._totalWork)
  927. done+=child._weight*child._worked/child._totalWork;totalWeights+=child._weight;}
  928. this._parent.setWorked(done/totalWeights);},__proto__:WebInspector.Object.prototype}
  929. WebInspector.SubProgress=function(composite,weight)
  930. {this._composite=composite;this._weight=weight||1;this._worked=0;}
  931. WebInspector.SubProgress.prototype={isCanceled:function()
  932. {return this._composite._parent.isCanceled();},setTitle:function(title)
  933. {this._composite._parent.setTitle(title);},done:function()
  934. {this.setWorked(this._totalWork);this._composite._childDone();this.dispatchEventToListeners(WebInspector.Progress.Events.Done);},setTotalWork:function(totalWork)
  935. {this._totalWork=totalWork;this._composite._update();},setWorked:function(worked,title)
  936. {this._worked=worked;if(typeof title!=="undefined")
  937. this.setTitle(title);this._composite._update();},worked:function(worked)
  938. {this.setWorked(this._worked+(worked||1));},__proto__:WebInspector.Object.prototype};WebInspector.ResourceType=function(name,title,categoryTitle,color,isTextType)
  939. {this._name=name;this._title=title;this._categoryTitle=categoryTitle;this._color=color;this._isTextType=isTextType;}
  940. WebInspector.ResourceType.prototype={name:function()
  941. {return this._name;},title:function()
  942. {return this._title;},categoryTitle:function()
  943. {return this._categoryTitle;},color:function()
  944. {return this._color;},isTextType:function()
  945. {return this._isTextType;},toString:function()
  946. {return this._name;},canonicalMimeType:function()
  947. {if(this===WebInspector.resourceTypes.Document)
  948. return"text/html";if(this===WebInspector.resourceTypes.Script)
  949. return"text/javascript";if(this===WebInspector.resourceTypes.Stylesheet)
  950. return"text/css";return"";}}
  951. WebInspector.resourceTypes={Document:new WebInspector.ResourceType("document","Document","Documents","rgb(47,102,236)",true),Stylesheet:new WebInspector.ResourceType("stylesheet","Stylesheet","Stylesheets","rgb(157,231,119)",true),Image:new WebInspector.ResourceType("image","Image","Images","rgb(164,60,255)",false),Media:new WebInspector.ResourceType("media","Media","Media","rgb(164,60,255)",false),Script:new WebInspector.ResourceType("script","Script","Scripts","rgb(255,121,0)",true),XHR:new WebInspector.ResourceType("xhr","XHR","XHR","rgb(231,231,10)",true),Font:new WebInspector.ResourceType("font","Font","Fonts","rgb(255,82,62)",false),TextTrack:new WebInspector.ResourceType("texttrack","TextTrack","TextTracks","rgb(164,60,255)",true),WebSocket:new WebInspector.ResourceType("websocket","WebSocket","WebSockets","rgb(186,186,186)",false),Other:new WebInspector.ResourceType("other","Other","Other","rgb(186,186,186)",false)}
  952. WebInspector.ResourceType.mimeTypesForExtensions={"js":"text/javascript","css":"text/css","html":"text/html","htm":"text/html","xml":"application/xml","xsl":"application/xml","asp":"application/x-aspx","aspx":"application/x-aspx","jsp":"application/x-jsp","c":"text/x-c++src","cc":"text/x-c++src","cpp":"text/x-c++src","h":"text/x-c++src","m":"text/x-c++src","mm":"text/x-c++src","coffee":"text/x-coffeescript","dart":"text/javascript","ts":"text/typescript","json":"application/json","gyp":"application/json","gypi":"application/json","cs":"text/x-csharp","java":"text/x-java","less":"text/x-less","php":"text/x-php","phtml":"application/x-httpd-php","py":"text/x-python","sh":"text/x-sh","scss":"text/x-scss","vtt":"text/vtt"};WebInspector.Settings=function()
  953. {this._eventSupport=new WebInspector.Object();this._registry=({});this.colorFormat=this.createSetting("colorFormat","original");this.consoleHistory=this.createSetting("consoleHistory",[]);this.domWordWrap=this.createSetting("domWordWrap",true);this.eventListenersFilter=this.createSetting("eventListenersFilter","all");this.lastViewedScriptFile=this.createSetting("lastViewedScriptFile","application");this.monitoringXHREnabled=this.createSetting("monitoringXHREnabled",false);this.hideNetworkMessages=this.createSetting("hideNetworkMessages",false);this.preserveConsoleLog=this.createSetting("preserveConsoleLog",false);this.consoleTimestampsEnabled=this.createSetting("consoleTimestampsEnabled",false);this.resourcesLargeRows=this.createSetting("resourcesLargeRows",true);this.resourceViewTab=this.createSetting("resourceViewTab","preview");this.showInheritedComputedStyleProperties=this.createSetting("showInheritedComputedStyleProperties",false);this.showUserAgentStyles=this.createSetting("showUserAgentStyles",true);this.watchExpressions=this.createSetting("watchExpressions",[]);this.breakpoints=this.createSetting("breakpoints",[]);this.eventListenerBreakpoints=this.createSetting("eventListenerBreakpoints",[]);this.domBreakpoints=this.createSetting("domBreakpoints",[]);this.xhrBreakpoints=this.createSetting("xhrBreakpoints",[]);this.jsSourceMapsEnabled=this.createSetting("sourceMapsEnabled",true);this.cssSourceMapsEnabled=this.createSetting("cssSourceMapsEnabled",true);this.cacheDisabled=this.createSetting("cacheDisabled",false);this.showUAShadowDOM=this.createSetting("showUAShadowDOM",false);this.savedURLs=this.createSetting("savedURLs",{});this.javaScriptDisabled=this.createSetting("javaScriptDisabled",false);this.showAdvancedHeapSnapshotProperties=this.createSetting("showAdvancedHeapSnapshotProperties",false);this.recordAllocationStacks=this.createSetting("recordAllocationStacks",false);this.highResolutionCpuProfiling=this.createSetting("highResolutionCpuProfiling",false);this.searchInContentScripts=this.createSetting("searchInContentScripts",false);this.textEditorIndent=this.createSetting("textEditorIndent","    ");this.textEditorAutoDetectIndent=this.createSetting("textEditorAutoIndentIndent",true);this.textEditorAutocompletion=this.createSetting("textEditorAutocompletion",true);this.textEditorBracketMatching=this.createSetting("textEditorBracketMatching",true);this.cssReloadEnabled=this.createSetting("cssReloadEnabled",false);this.timelineLiveUpdate=this.createSetting("timelineLiveUpdate",true);this.showMetricsRulers=this.createSetting("showMetricsRulers",false);this.workerInspectorWidth=this.createSetting("workerInspectorWidth",600);this.workerInspectorHeight=this.createSetting("workerInspectorHeight",600);this.messageURLFilters=this.createSetting("messageURLFilters",{});this.networkLogHideColumns=this.createSetting("networkLogHideColumns",false);this.networkHideDataURL=this.createSetting("networkHideDataURL",false);this.networkResourceTypeFilters=this.createSetting("networkResourceTypeFilters",{});this.networkShowPrimaryLoadWaterfall=this.createSetting("networkShowPrimaryLoadWaterfall",false);this.networkColorCodeResourceTypes=this.createSetting("networkColorCodeResourceTypes",false);this.messageLevelFilters=this.createSetting("messageLevelFilters",{});this.splitVerticallyWhenDockedToRight=this.createSetting("splitVerticallyWhenDockedToRight",true);this.visiblePanels=this.createSetting("visiblePanels",{});this.shortcutPanelSwitch=this.createSetting("shortcutPanelSwitch",false);this.showWhitespacesInEditor=this.createSetting("showWhitespacesInEditor",false);this.skipStackFramesPattern=this.createRegExpSetting("skipStackFramesPattern","");this.skipContentScripts=this.createSetting("skipContentScripts",false);this.pauseOnExceptionEnabled=this.createSetting("pauseOnExceptionEnabled",false);this.pauseOnCaughtException=this.createSetting("pauseOnCaughtException",false);this.enableAsyncStackTraces=this.createSetting("enableAsyncStackTraces",false);this.showMediaQueryInspector=this.createSetting("showMediaQueryInspector",false);this.disableOverridesWarning=this.createSetting("disableOverridesWarning",false);this.disablePausedStateOverlay=this.createSetting("disablePausedStateOverlay",false);this.testPath=this.createSetting("testPath","");this.frameViewerHideChromeWindow=this.createSetting("frameViewerHideChromeWindow",false);this.highlightDOMUpdates=this.createSetting("highlightDOMUpdates",true);this.enableCustomFormatters=this.createSetting("customFormatters",false);this.showPaintRects=this.createSetting("showPaintRects",false);this.showDebugBorders=this.createSetting("showDebugBorders",false);this.showFPSCounter=this.createSetting("showFPSCounter",false);this.continuousPainting=this.createSetting("continuousPainting",false);this.showScrollBottleneckRects=this.createSetting("showScrollBottleneckRects",false);}
  954. WebInspector.Settings.prototype={createSetting:function(key,defaultValue)
  955. {if(!this._registry[key])
  956. this._registry[key]=new WebInspector.Setting(key,defaultValue,this._eventSupport,window.localStorage);return this._registry[key];},createRegExpSetting:function(key,defaultValue,regexFlags)
  957. {if(!this._registry[key])
  958. this._registry[key]=new WebInspector.RegExpSetting(key,defaultValue,this._eventSupport,window.localStorage,regexFlags);return this._registry[key];}}
  959. WebInspector.Setting=function(name,defaultValue,eventSupport,storage)
  960. {this._name=name;this._defaultValue=defaultValue;this._eventSupport=eventSupport;this._storage=storage;}
  961. WebInspector.Setting.prototype={addChangeListener:function(listener,thisObject)
  962. {this._eventSupport.addEventListener(this._name,listener,thisObject);},removeChangeListener:function(listener,thisObject)
  963. {this._eventSupport.removeEventListener(this._name,listener,thisObject);},get name()
  964. {return this._name;},get:function()
  965. {if(typeof this._value!=="undefined")
  966. return this._value;this._value=this._defaultValue;if(this._storage&&this._name in this._storage){try{this._value=JSON.parse(this._storage[this._name]);}catch(e){delete this._storage[this._name];}}
  967. return this._value;},set:function(value)
  968. {this._value=value;if(this._storage){try{var settingString=JSON.stringify(value);try{this._storage[this._name]=settingString;}catch(e){this._printSettingsSavingError(e.message,this._name,settingString);}}catch(e){WebInspector.console.error("Cannot stringify setting with name: "+this._name+", error: "+e.message);}}
  969. this._eventSupport.dispatchEventToListeners(this._name,value);},_printSettingsSavingError:function(message,name,value)
  970. {var errorMessage="Error saving setting with name: "+this._name+", value length: "+value.length+". Error: "+message;console.error(errorMessage);WebInspector.console.error(errorMessage);WebInspector.console.log("Ten largest settings: ");var sizes={__proto__:null};for(var key in this._storage)
  971. sizes[key]=this._storage.getItem(key).length;var keys=Object.keys(sizes);function comparator(key1,key2)
  972. {return sizes[key2]-sizes[key1];}
  973. keys.sort(comparator);for(var i=0;i<10&&i<keys.length;++i)
  974. WebInspector.console.log("Setting: '"+keys[i]+"', size: "+sizes[keys[i]]);},}
  975. WebInspector.RegExpSetting=function(name,defaultValue,eventSupport,storage,regexFlags)
  976. {WebInspector.Setting.call(this,name,defaultValue?[{pattern:defaultValue}]:[],eventSupport,storage);this._regexFlags=regexFlags;}
  977. WebInspector.RegExpSetting.prototype={get:function()
  978. {var result=[];var items=this.getAsArray();for(var i=0;i<items.length;++i){var item=items[i];if(item.pattern&&!item.disabled)
  979. result.push(item.pattern);}
  980. return result.join("|");},getAsArray:function()
  981. {return WebInspector.Setting.prototype.get.call(this);},set:function(value)
  982. {this.setAsArray([{pattern:value}]);},setAsArray:function(value)
  983. {delete this._regex;WebInspector.Setting.prototype.set.call(this,value);},asRegExp:function()
  984. {if(typeof this._regex!=="undefined")
  985. return this._regex;this._regex=null;try{var pattern=this.get();if(pattern)
  986. this._regex=new RegExp(pattern,this._regexFlags||"");}catch(e){}
  987. return this._regex;},__proto__:WebInspector.Setting.prototype}
  988. WebInspector.VersionController=function()
  989. {}
  990. WebInspector.VersionController.currentVersion=10;WebInspector.VersionController.prototype={updateVersion:function()
  991. {var versionSetting=WebInspector.settings.createSetting("inspectorVersion",0);var currentVersion=WebInspector.VersionController.currentVersion;var oldVersion=versionSetting.get();var methodsToRun=this._methodsToRunToUpdateVersion(oldVersion,currentVersion);for(var i=0;i<methodsToRun.length;++i)
  992. this[methodsToRun[i]].call(this);versionSetting.set(currentVersion);},_methodsToRunToUpdateVersion:function(oldVersion,currentVersion)
  993. {var result=[];for(var i=oldVersion;i<currentVersion;++i)
  994. result.push("_updateVersionFrom"+i+"To"+(i+1));return result;},_updateVersionFrom0To1:function()
  995. {this._clearBreakpointsWhenTooMany(WebInspector.settings.breakpoints,500000);},_updateVersionFrom1To2:function()
  996. {var versionSetting=WebInspector.settings.createSetting("previouslyViewedFiles",[]);versionSetting.set([]);},_updateVersionFrom2To3:function()
  997. {var fileSystemMappingSetting=WebInspector.settings.createSetting("fileSystemMapping",{});fileSystemMappingSetting.set({});if(window.localStorage)
  998. delete window.localStorage["fileMappingEntries"];},_updateVersionFrom3To4:function()
  999. {var advancedMode=WebInspector.settings.createSetting("showHeaSnapshotObjectsHiddenProperties",false).get();WebInspector.settings.showAdvancedHeapSnapshotProperties.set(advancedMode);},_updateVersionFrom4To5:function()
  1000. {if(!window.localStorage)
  1001. return;var settingNames={"FileSystemViewSidebarWidth":"fileSystemViewSplitViewState","canvasProfileViewReplaySplitLocation":"canvasProfileViewReplaySplitViewState","canvasProfileViewSplitLocation":"canvasProfileViewSplitViewState","elementsSidebarWidth":"elementsPanelSplitViewState","StylesPaneSplitRatio":"stylesPaneSplitViewState","heapSnapshotRetainersViewSize":"heapSnapshotSplitViewState","InspectorView.splitView":"InspectorView.splitViewState","InspectorView.screencastSplitView":"InspectorView.screencastSplitViewState","Inspector.drawerSplitView":"Inspector.drawerSplitViewState","layerDetailsSplitView":"layerDetailsSplitViewState","networkSidebarWidth":"networkPanelSplitViewState","sourcesSidebarWidth":"sourcesPanelSplitViewState","scriptsPanelNavigatorSidebarWidth":"sourcesPanelNavigatorSplitViewState","sourcesPanelSplitSidebarRatio":"sourcesPanelDebuggerSidebarSplitViewState","timeline-details":"timelinePanelDetailsSplitViewState","timeline-split":"timelinePanelRecorsSplitViewState","timeline-view":"timelinePanelTimelineStackSplitViewState","auditsSidebarWidth":"auditsPanelSplitViewState","layersSidebarWidth":"layersPanelSplitViewState","profilesSidebarWidth":"profilesPanelSplitViewState","resourcesSidebarWidth":"resourcesPanelSplitViewState"};for(var oldName in settingNames){var newName=settingNames[oldName];var oldNameH=oldName+"H";var newValue=null;var oldSetting=WebInspector.settings.createSetting(oldName,undefined).get();if(oldSetting){newValue=newValue||{};newValue.vertical={};newValue.vertical.size=oldSetting;delete window.localStorage[oldName];}
  1002. var oldSettingH=WebInspector.settings.createSetting(oldNameH,undefined).get();if(oldSettingH){newValue=newValue||{};newValue.horizontal={};newValue.horizontal.size=oldSettingH;delete window.localStorage[oldNameH];}
  1003. var newSetting=WebInspector.settings.createSetting(newName,{});if(newValue)
  1004. newSetting.set(newValue);}},_updateVersionFrom5To6:function()
  1005. {if(!window.localStorage)
  1006. return;var settingNames={"debuggerSidebarHidden":"sourcesPanelSplitViewState","navigatorHidden":"sourcesPanelNavigatorSplitViewState","WebInspector.Drawer.showOnLoad":"Inspector.drawerSplitViewState"};for(var oldName in settingNames){var newName=settingNames[oldName];var oldSetting=WebInspector.settings.createSetting(oldName,undefined).get();var invert="WebInspector.Drawer.showOnLoad"===oldName;var hidden=!!oldSetting!==invert;delete window.localStorage[oldName];var showMode=hidden?"OnlyMain":"Both";var newSetting=WebInspector.settings.createSetting(newName,null);var newValue=newSetting.get()||{};newValue.vertical=newValue.vertical||{};newValue.vertical.showMode=showMode;newValue.horizontal=newValue.horizontal||{};newValue.horizontal.showMode=showMode;newSetting.set(newValue);}},_updateVersionFrom6To7:function()
  1007. {if(!window.localStorage)
  1008. return;var settingNames={"sourcesPanelNavigatorSplitViewState":"sourcesPanelNavigatorSplitViewState","elementsPanelSplitViewState":"elementsPanelSplitViewState","canvasProfileViewReplaySplitViewState":"canvasProfileViewReplaySplitViewState","stylesPaneSplitViewState":"stylesPaneSplitViewState","sourcesPanelDebuggerSidebarSplitViewState":"sourcesPanelDebuggerSidebarSplitViewState"};for(var name in settingNames){if(!(name in window.localStorage))
  1009. continue;var setting=WebInspector.settings.createSetting(name,undefined);var value=setting.get();if(!value)
  1010. continue;if(value.vertical&&value.vertical.size&&value.vertical.size<1)
  1011. value.vertical.size=0;if(value.horizontal&&value.horizontal.size&&value.horizontal.size<1)
  1012. value.horizontal.size=0;setting.set(value);}},_updateVersionFrom7To8:function()
  1013. {var settingName="deviceMetrics";if(!window.localStorage||!(settingName in window.localStorage))
  1014. return;var setting=WebInspector.settings.createSetting(settingName,undefined);var value=setting.get();if(!value)
  1015. return;var components=value.split("x");if(components.length>=3){var width=parseInt(components[0],10);var height=parseInt(components[1],10);var deviceScaleFactor=parseFloat(components[2]);if(deviceScaleFactor){components[0]=""+Math.round(width/deviceScaleFactor);components[1]=""+Math.round(height/deviceScaleFactor);}}
  1016. value=components.join("x");setting.set(value);},_updateVersionFrom8To9:function()
  1017. {if(!window.localStorage)
  1018. return;var settingNames=["skipStackFramesPattern","workspaceFolderExcludePattern"];for(var i=0;i<settingNames.length;++i){var settingName=settingNames[i];if(!(settingName in window.localStorage))
  1019. continue;try{var value=JSON.parse(window.localStorage[settingName]);if(!value)
  1020. continue;if(typeof value==="string")
  1021. value=[value];for(var j=0;j<value.length;++j){if(typeof value[j]==="string")
  1022. value[j]={pattern:value[j]};}
  1023. window.localStorage[settingName]=JSON.stringify(value);}catch(e){}}},_updateVersionFrom9To10:function()
  1024. {if(!window.localStorage)
  1025. return;for(var key in window.localStorage){if(key.startsWith("revision-history"))
  1026. window.localStorage.removeItem(key);}},_clearBreakpointsWhenTooMany:function(breakpointsSetting,maxBreakpointsCount)
  1027. {if(breakpointsSetting.get().length>maxBreakpointsCount)
  1028. breakpointsSetting.set([]);}}
  1029. WebInspector.settings;WebInspector.PauseOnExceptionStateSetting=function()
  1030. {WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._enabledChanged,this);WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOnCaughtChanged,this);this._name="pauseOnExceptionStateString";this._eventSupport=new WebInspector.Object();this._value=this._calculateValue();}
  1031. WebInspector.PauseOnExceptionStateSetting.prototype={addChangeListener:function(listener,thisObject)
  1032. {this._eventSupport.addEventListener(this._name,listener,thisObject);},removeChangeListener:function(listener,thisObject)
  1033. {this._eventSupport.removeEventListener(this._name,listener,thisObject);},get:function()
  1034. {return this._value;},_calculateValue:function()
  1035. {if(!WebInspector.settings.pauseOnExceptionEnabled.get())
  1036. return"none";return"all";},_enabledChanged:function(event)
  1037. {this._fireChangedIfNeeded();},_pauseOnCaughtChanged:function(event)
  1038. {this._fireChangedIfNeeded();},_fireChangedIfNeeded:function()
  1039. {var newValue=this._calculateValue();if(newValue===this._value)
  1040. return;this._value=newValue;this._eventSupport.dispatchEventToListeners(this._name,this._value);}};WebInspector.StaticContentProvider=function(contentType,content,contentURL)
  1041. {this._content=content;this._contentType=contentType;this._contentURL=contentURL||"";}
  1042. WebInspector.StaticContentProvider.searchInContent=function(content,query,caseSensitive,isRegex,callback)
  1043. {function performSearch()
  1044. {callback(WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex));}
  1045. setTimeout(performSearch.bind(null),0);}
  1046. WebInspector.StaticContentProvider.prototype={contentURL:function()
  1047. {return this._contentURL;},contentType:function()
  1048. {return this._contentType;},requestContent:function(callback)
  1049. {callback(this._content);},searchInContent:function(query,caseSensitive,isRegex,callback)
  1050. {WebInspector.StaticContentProvider.searchInContent(this._content,query,caseSensitive,isRegex,callback);}};WebInspector.TextRange=function(startLine,startColumn,endLine,endColumn)
  1051. {this.startLine=startLine;this.startColumn=startColumn;this.endLine=endLine;this.endColumn=endColumn;}
  1052. WebInspector.TextRange.createFromLocation=function(line,column)
  1053. {return new WebInspector.TextRange(line,column,line,column);}
  1054. WebInspector.TextRange.fromObject=function(serializedTextRange)
  1055. {return new WebInspector.TextRange(serializedTextRange.startLine,serializedTextRange.startColumn,serializedTextRange.endLine,serializedTextRange.endColumn);}
  1056. WebInspector.TextRange.comparator=function(range1,range2)
  1057. {return range1.compareTo(range2);}
  1058. WebInspector.TextRange.prototype={isEmpty:function()
  1059. {return this.startLine===this.endLine&&this.startColumn===this.endColumn;},immediatelyPrecedes:function(range)
  1060. {if(!range)
  1061. return false;return this.endLine===range.startLine&&this.endColumn===range.startColumn;},immediatelyFollows:function(range)
  1062. {if(!range)
  1063. return false;return range.immediatelyPrecedes(this);},follows:function(range)
  1064. {return(range.endLine===this.startLine&&range.endColumn<=this.startColumn)||range.endLine<this.startLine;},get linesCount()
  1065. {return this.endLine-this.startLine;},collapseToEnd:function()
  1066. {return new WebInspector.TextRange(this.endLine,this.endColumn,this.endLine,this.endColumn);},collapseToStart:function()
  1067. {return new WebInspector.TextRange(this.startLine,this.startColumn,this.startLine,this.startColumn);},normalize:function()
  1068. {if(this.startLine>this.endLine||(this.startLine===this.endLine&&this.startColumn>this.endColumn))
  1069. return new WebInspector.TextRange(this.endLine,this.endColumn,this.startLine,this.startColumn);else
  1070. return this.clone();},clone:function()
  1071. {return new WebInspector.TextRange(this.startLine,this.startColumn,this.endLine,this.endColumn);},serializeToObject:function()
  1072. {var serializedTextRange={};serializedTextRange.startLine=this.startLine;serializedTextRange.startColumn=this.startColumn;serializedTextRange.endLine=this.endLine;serializedTextRange.endColumn=this.endColumn;return serializedTextRange;},compareTo:function(other)
  1073. {if(this.startLine>other.startLine)
  1074. return 1;if(this.startLine<other.startLine)
  1075. return-1;if(this.startColumn>other.startColumn)
  1076. return 1;if(this.startColumn<other.startColumn)
  1077. return-1;return 0;},equal:function(other)
  1078. {return this.startLine===other.startLine&&this.endLine===other.endLine&&this.startColumn===other.startColumn&&this.endColumn===other.endColumn;},shift:function(lineOffset)
  1079. {return new WebInspector.TextRange(this.startLine+lineOffset,this.startColumn,this.endLine+lineOffset,this.endColumn);},rebaseAfterTextEdit:function(originalRange,editedRange)
  1080. {console.assert(originalRange.startLine===editedRange.startLine);console.assert(originalRange.startColumn===editedRange.startColumn);var rebase=this.clone();if(!this.follows(originalRange))
  1081. return rebase;var lineDelta=editedRange.endLine-originalRange.endLine;var columnDelta=editedRange.endColumn-originalRange.endColumn;rebase.startLine+=lineDelta;rebase.endLine+=lineDelta;if(rebase.startLine===editedRange.endLine)
  1082. rebase.startColumn+=columnDelta;if(rebase.endLine===editedRange.endLine)
  1083. rebase.endColumn+=columnDelta;return rebase;},toString:function()
  1084. {return JSON.stringify(this);}}
  1085. WebInspector.SourceRange=function(offset,length)
  1086. {this.offset=offset;this.length=length;};WebInspector.TextUtils={isStopChar:function(char)
  1087. {return(char>" "&&char<"0")||(char>"9"&&char<"A")||(char>"Z"&&char<"_")||(char>"_"&&char<"a")||(char>"z"&&char<="~");},isWordChar:function(char)
  1088. {return!WebInspector.TextUtils.isStopChar(char)&&!WebInspector.TextUtils.isSpaceChar(char);},isSpaceChar:function(char)
  1089. {return WebInspector.TextUtils._SpaceCharRegex.test(char);},isWord:function(word)
  1090. {for(var i=0;i<word.length;++i){if(!WebInspector.TextUtils.isWordChar(word.charAt(i)))
  1091. return false;}
  1092. return true;},isOpeningBraceChar:function(char)
  1093. {return char==="("||char==="{";},isClosingBraceChar:function(char)
  1094. {return char===")"||char==="}";},isBraceChar:function(char)
  1095. {return WebInspector.TextUtils.isOpeningBraceChar(char)||WebInspector.TextUtils.isClosingBraceChar(char);},textToWords:function(text,isWordChar)
  1096. {var words=[];var startWord=-1;for(var i=0;i<text.length;++i){if(!isWordChar(text.charAt(i))){if(startWord!==-1)
  1097. words.push(text.substring(startWord,i));startWord=-1;}else if(startWord===-1)
  1098. startWord=i;}
  1099. if(startWord!==-1)
  1100. words.push(text.substring(startWord));return words;},findBalancedCurlyBrackets:function(source,startIndex,lastIndex)
  1101. {lastIndex=lastIndex||source.length;startIndex=startIndex||0;var counter=0;var index=startIndex;while(index<lastIndex){for(;index<lastIndex;++index){var character=source[index];if(character==="\"")
  1102. break;else if(character==="{")
  1103. ++counter;else if(character==="}"){if(--counter===0)
  1104. return index+1;}}
  1105. if(index===lastIndex)
  1106. return-1;var regexp=WebInspector.TextUtils._ClosingDoubleQuoteRegexp;regexp.lastIndex=index;if(!regexp.test(source))
  1107. return-1;index=regexp.lastIndex;}
  1108. return-1;},lineIndent:function(line)
  1109. {var indentation=0;while(indentation<line.length&&WebInspector.TextUtils.isSpaceChar(line.charAt(indentation)))
  1110. ++indentation;return line.substr(0,indentation);},isUpperCase:function(text)
  1111. {return text===text.toUpperCase();},isLowerCase:function(text)
  1112. {return text===text.toLowerCase();}}
  1113. WebInspector.TextUtils._SpaceCharRegex=/\s/;WebInspector.TextUtils._ClosingDoubleQuoteRegexp=/[^\\](?:\\\\)*"/g;WebInspector.TextUtils.Indent={TwoSpaces:"  ",FourSpaces:"    ",EightSpaces:"        ",TabCharacter:"\t"};WebInspector.Throttler=function(timeout)
  1114. {this._timeout=timeout;this._isRunningProcess=false;this._asSoonAsPossible=false;this._process=null;}
  1115. WebInspector.Throttler.prototype={_processCompleted:function()
  1116. {this._isRunningProcess=false;if(this._process)
  1117. this._innerSchedule(false);this._processCompletedForTests();},_processCompletedForTests:function()
  1118. {},_onTimeout:function()
  1119. {delete this._processTimeout;this._asSoonAsPossible=false;this._isRunningProcess=true;var process=this._process;this._process=null;process(this._processCompleted.bind(this));},schedule:function(process,asSoonAsPossible)
  1120. {this._process=process;var hasScheduledTasks=!!this._processTimeout||this._isRunningProcess;asSoonAsPossible=!!asSoonAsPossible||!hasScheduledTasks;var forceTimerUpdate=asSoonAsPossible&&!this._asSoonAsPossible;this._asSoonAsPossible=this._asSoonAsPossible||asSoonAsPossible;this._innerSchedule(forceTimerUpdate);},_innerSchedule:function(forceTimerUpdate)
  1121. {if(this._isRunningProcess)
  1122. return;if(this._processTimeout&&!forceTimerUpdate)
  1123. return;if(this._processTimeout)
  1124. this._clearTimeout(this._processTimeout);var timeout=this._asSoonAsPossible?0:this._timeout;this._processTimeout=this._setTimeout(this._onTimeout.bind(this),timeout);},_clearTimeout:function(timeoutId)
  1125. {clearTimeout(timeoutId);},_setTimeout:function(operation,timeout)
  1126. {return setTimeout(operation,timeout);}}
  1127. WebInspector.Throttler.FinishCallback;;WebInspector.UIString=function(string,vararg)
  1128. {return String.vsprintf(WebInspector.localize(string),Array.prototype.slice.call(arguments,1));}
  1129. WebInspector.UIString.capitalize=function(string,vararg)
  1130. {if(WebInspector._useLowerCaseMenuTitles===undefined)
  1131. throw"WebInspector.setLocalizationPlatform() has not been called";var localized=WebInspector.localize(string);var capitalized;if(WebInspector._useLowerCaseMenuTitles)
  1132. capitalized=localized.replace(/\^(.)/g,"$1");else
  1133. capitalized=localized.replace(/\^(.)/g,function(str,char){return char.toUpperCase();});return String.vsprintf(capitalized,Array.prototype.slice.call(arguments,1));}
  1134. WebInspector.setLocalizationPlatform=function(platform)
  1135. {WebInspector._useLowerCaseMenuTitles=platform==="windows";}
  1136. WebInspector.localize=function(string)
  1137. {return string;}
  1138. WebInspector.UIStringFormat=function(format)
  1139. {this._localizedFormat=WebInspector.localize(format);this._tokenizedFormat=String.tokenizeFormatString(this._localizedFormat,String.standardFormatters);}
  1140. WebInspector.UIStringFormat._append=function(a,b)
  1141. {return a+b;}
  1142. WebInspector.UIStringFormat.prototype={format:function(vararg)
  1143. {return String.format(this._localizedFormat,arguments,String.standardFormatters,"",WebInspector.UIStringFormat._append,this._tokenizedFormat).formattedResult;}};WebInspector.Renderer=function()
  1144. {}
  1145. WebInspector.Renderer.prototype={render:function(object){}}
  1146. WebInspector.Renderer.renderPromise=function(object)
  1147. {if(!object)
  1148. return Promise.reject(new Error("Can't render "+object));return self.runtime.instancePromise(WebInspector.Renderer,object).then(render);function render(renderer)
  1149. {return renderer.render(object);}}
  1150. WebInspector.Revealer=function()
  1151. {}
  1152. WebInspector.Revealer.reveal=function(revealable,lineNumber)
  1153. {WebInspector.Revealer.revealPromise(revealable,lineNumber);}
  1154. WebInspector.Revealer.revealPromise=function(revealable,lineNumber)
  1155. {if(!revealable)
  1156. return Promise.reject(new Error("Can't reveal "+revealable));return self.runtime.instancesPromise(WebInspector.Revealer,revealable).then(reveal);function reveal(revealers)
  1157. {var promises=[];for(var i=0;i<revealers.length;++i)
  1158. promises.push(revealers[i].reveal((revealable),lineNumber));return Promise.race(promises);}}
  1159. WebInspector.Revealer.prototype={reveal:function(object,lineNumber){}};function InspectorFrontendHostAPI()
  1160. {this.events;}
  1161. InspectorFrontendHostAPI.ContextMenuDescriptor;InspectorFrontendHostAPI.Events={AddExtensions:"addExtensions",AppendedToURL:"appendedToURL",CanceledSaveURL:"canceledSaveURL",ContextMenuCleared:"contextMenuCleared",ContextMenuItemSelected:"contextMenuItemSelected",DeviceCountUpdated:"deviceCountUpdated",DevicesUpdated:"devicesUpdated",DispatchMessage:"dispatchMessage",DispatchMessageChunk:"dispatchMessageChunk",EnterInspectElementMode:"enterInspectElementMode",FileSystemsLoaded:"fileSystemsLoaded",FileSystemRemoved:"fileSystemRemoved",FileSystemAdded:"fileSystemAdded",IndexingTotalWorkCalculated:"indexingTotalWorkCalculated",IndexingWorked:"indexingWorked",IndexingDone:"indexingDone",KeyEventUnhandled:"keyEventUnhandled",RevealSourceLine:"revealSourceLine",SavedURL:"savedURL",SearchCompleted:"searchCompleted",SetInspectedTabId:"setInspectedTabId",SetToolbarColors:"setToolbarColors",SetUseSoftMenu:"setUseSoftMenu",ShowConsole:"showConsole"}
  1162. InspectorFrontendHostAPI.EventDescriptors=[[InspectorFrontendHostAPI.Events.AddExtensions,["extensions"]],[InspectorFrontendHostAPI.Events.AppendedToURL,["url"]],[InspectorFrontendHostAPI.Events.CanceledSaveURL,["url"]],[InspectorFrontendHostAPI.Events.ContextMenuCleared,[]],[InspectorFrontendHostAPI.Events.ContextMenuItemSelected,["id"]],[InspectorFrontendHostAPI.Events.DeviceCountUpdated,["count"]],[InspectorFrontendHostAPI.Events.DevicesUpdated,["devices"]],[InspectorFrontendHostAPI.Events.DispatchMessage,["messageObject"]],[InspectorFrontendHostAPI.Events.DispatchMessageChunk,["messageChunk","messageSize"]],[InspectorFrontendHostAPI.Events.EnterInspectElementMode,[]],[InspectorFrontendHostAPI.Events.FileSystemsLoaded,["fileSystems"]],[InspectorFrontendHostAPI.Events.FileSystemRemoved,["fileSystemPath"]],[InspectorFrontendHostAPI.Events.FileSystemAdded,["errorMessage","fileSystem"]],[InspectorFrontendHostAPI.Events.IndexingTotalWorkCalculated,["requestId","fileSystemPath","totalWork"]],[InspectorFrontendHostAPI.Events.IndexingWorked,["requestId","fileSystemPath","worked"]],[InspectorFrontendHostAPI.Events.IndexingDone,["requestId","fileSystemPath"]],[InspectorFrontendHostAPI.Events.KeyEventUnhandled,["event"]],[InspectorFrontendHostAPI.Events.RevealSourceLine,["url","lineNumber","columnNumber"]],[InspectorFrontendHostAPI.Events.SavedURL,["url"]],[InspectorFrontendHostAPI.Events.SearchCompleted,["requestId","fileSystemPath","files"]],[InspectorFrontendHostAPI.Events.SetInspectedTabId,["tabId"]],[InspectorFrontendHostAPI.Events.SetToolbarColors,["backgroundColor","color"]],[InspectorFrontendHostAPI.Events.SetUseSoftMenu,["useSoftMenu"]],[InspectorFrontendHostAPI.Events.ShowConsole,[]]];InspectorFrontendHostAPI.prototype={addFileSystem:function(){},append:function(url,content){},loadCompleted:function(){},indexPath:function(requestId,fileSystemPath){},getSelectionBackgroundColor:function(){},getSelectionForegroundColor:function(){},setInspectedPageBounds:function(bounds){},setWhitelistedShortcuts:function(shortcuts){},inspectElementCompleted:function(){},openInNewTab:function(url){},removeFileSystem:function(fileSystemPath){},requestFileSystems:function(){},save:function(url,content,forceSaveAs){},searchInPath:function(requestId,fileSystemPath,query){},stopIndexing:function(requestId){},bringToFront:function(){},openUrlOnRemoteDeviceAndInspect:function(browserId,url){},closeWindow:function(){},copyText:function(text){},inspectedURLChanged:function(url){},isolatedFileSystem:function(fileSystemId,registeredName){},upgradeDraggedFileSystemPermissions:function(fileSystem){},platform:function(){},recordActionTaken:function(actionCode){},recordPanelShown:function(panelCode){},sendMessageToBackend:function(message){},setDeviceCountUpdatesEnabled:function(enabled){},setDevicesUpdatesEnabled:function(enabled){},setInjectedScriptForOrigin:function(origin,script){},setIsDocked:function(isDocked,callback){},zoomFactor:function(){},zoomIn:function(){},zoomOut:function(){},resetZoom:function(){},showContextMenuAtPoint:function(x,y,items,document){},isUnderTest:function(){},isHostedMode:function(){}}
  1163. WebInspector.InspectorFrontendHostStub=function()
  1164. {function stopEventPropagation(event)
  1165. {var zoomModifier=WebInspector.isMac()?event.metaKey:event.ctrlKey;if(zoomModifier&&(event.keyCode===187||event.keyCode===189))
  1166. event.stopPropagation();}
  1167. document.addEventListener("keydown",stopEventPropagation,true);}
  1168. WebInspector.InspectorFrontendHostStub.prototype={getSelectionBackgroundColor:function()
  1169. {return"#6e86ff";},getSelectionForegroundColor:function()
  1170. {return"#ffffff";},platform:function()
  1171. {var match=navigator.userAgent.match(/Windows NT/);if(match)
  1172. return"windows";match=navigator.userAgent.match(/Mac OS X/);if(match)
  1173. return"mac";return"linux";},loadCompleted:function()
  1174. {},bringToFront:function()
  1175. {this._windowVisible=true;},closeWindow:function()
  1176. {this._windowVisible=false;},setIsDocked:function(isDocked,callback)
  1177. {},setInspectedPageBounds:function(bounds)
  1178. {},inspectElementCompleted:function()
  1179. {},setInjectedScriptForOrigin:function(origin,script)
  1180. {},inspectedURLChanged:function(url)
  1181. {document.title=WebInspector.UIString("Developer Tools - %s",url);},copyText:function(text)
  1182. {WebInspector.console.error("Clipboard is not enabled in hosted mode. Please inspect using chrome://inspect");},openInNewTab:function(url)
  1183. {window.open(url,"_blank");},save:function(url,content,forceSaveAs)
  1184. {WebInspector.console.error("Saving files is not enabled in hosted mode. Please inspect using chrome://inspect");this.events.dispatchEventToListeners(InspectorFrontendHostAPI.Events.CanceledSaveURL,url);},append:function(url,content)
  1185. {WebInspector.console.error("Saving files is not enabled in hosted mode. Please inspect using chrome://inspect");},sendMessageToBackend:function(message)
  1186. {},recordActionTaken:function(actionCode)
  1187. {},recordPanelShown:function(panelCode)
  1188. {},requestFileSystems:function()
  1189. {},addFileSystem:function()
  1190. {},removeFileSystem:function(fileSystemPath)
  1191. {},isolatedFileSystem:function(fileSystemId,registeredName)
  1192. {return null;},upgradeDraggedFileSystemPermissions:function(fileSystem)
  1193. {},indexPath:function(requestId,fileSystemPath)
  1194. {},stopIndexing:function(requestId)
  1195. {},searchInPath:function(requestId,fileSystemPath,query)
  1196. {},zoomFactor:function()
  1197. {return 1;},zoomIn:function()
  1198. {},zoomOut:function()
  1199. {},resetZoom:function()
  1200. {},setWhitelistedShortcuts:function(shortcuts)
  1201. {},isUnderTest:function()
  1202. {return false;},openUrlOnRemoteDeviceAndInspect:function(browserId,url)
  1203. {},setDeviceCountUpdatesEnabled:function(enabled)
  1204. {},setDevicesUpdatesEnabled:function(enabled)
  1205. {},showContextMenuAtPoint:function(x,y,items,document)
  1206. {throw"Soft context menu should be used";},isHostedMode:function()
  1207. {return true;}};var InspectorFrontendHost=window.InspectorFrontendHost||null;(function(){function initializeInspectorFrontendHost()
  1208. {if(!InspectorFrontendHost){InspectorFrontendHost=new WebInspector.InspectorFrontendHostStub();}else{var proto=WebInspector.InspectorFrontendHostStub.prototype;for(var name in proto){var value=proto[name];if(typeof value!=="function"||InspectorFrontendHost[name])
  1209. continue;InspectorFrontendHost[name]=stub.bind(null,name);}}
  1210. function stub(name)
  1211. {console.error("Incompatible embedder: method InspectorFrontendHost."+name+" is missing. Using stub instead.");var args=Array.prototype.slice.call(arguments,1);return proto[name].apply(InspectorFrontendHost,args);}
  1212. InspectorFrontendHost.events=new WebInspector.Object();}
  1213. function InspectorFrontendAPIImpl()
  1214. {this._debugFrontend=!!Runtime.queryParam("debugFrontend");var descriptors=InspectorFrontendHostAPI.EventDescriptors;for(var i=0;i<descriptors.length;++i)
  1215. this[descriptors[i][0]]=this._dispatch.bind(this,descriptors[i][0],descriptors[i][1],descriptors[i][2]);}
  1216. InspectorFrontendAPIImpl.prototype={_dispatch:function(name,signature,runOnceLoaded)
  1217. {var params=Array.prototype.slice.call(arguments,3);if(this._debugFrontend)
  1218. setImmediate(innerDispatch);else
  1219. innerDispatch();function innerDispatch()
  1220. {if(signature.length<2){InspectorFrontendHost.events.dispatchEventToListeners(name,params[0]);return;}
  1221. var data={};for(var i=0;i<signature.length;++i)
  1222. data[signature[i]]=params[i];InspectorFrontendHost.events.dispatchEventToListeners(name,data);}}}
  1223. if(!window.DevToolsHost){initializeInspectorFrontendHost();window.InspectorFrontendAPI=new InspectorFrontendAPIImpl();WebInspector.setLocalizationPlatform(InspectorFrontendHost.platform());}else{WebInspector.setLocalizationPlatform(DevToolsHost.platform());}})();;WebInspector.platform=function()
  1224. {if(!WebInspector._platform)
  1225. WebInspector._platform=InspectorFrontendHost.platform();return WebInspector._platform;}
  1226. WebInspector.isMac=function()
  1227. {if(typeof WebInspector._isMac==="undefined")
  1228. WebInspector._isMac=WebInspector.platform()==="mac";return WebInspector._isMac;}
  1229. WebInspector.isWin=function()
  1230. {if(typeof WebInspector._isWin==="undefined")
  1231. WebInspector._isWin=WebInspector.platform()==="windows";return WebInspector._isWin;}
  1232. WebInspector.fontFamily=function()
  1233. {if(WebInspector._fontFamily)
  1234. return WebInspector._fontFamily;switch(WebInspector.platform()){case"linux":WebInspector._fontFamily="Ubuntu, Arial, sans-serif";break;case"mac":WebInspector._fontFamily="'Lucida Grande', sans-serif";break;case"windows":WebInspector._fontFamily="'Segoe UI', Tahoma, sans-serif";break;}
  1235. return WebInspector._fontFamily;}
  1236. WebInspector.monospaceFontFamily=function()
  1237. {if(WebInspector._monospaceFontFamily)
  1238. return WebInspector._monospaceFontFamily;switch(WebInspector.platform()){case"linux":WebInspector._monospaceFontFamily="dejavu sans mono, monospace";break;case"mac":WebInspector._monospaceFontFamily="Menlo, monospace";break;case"windows":WebInspector._monospaceFontFamily="Consolas, monospace";break;}
  1239. return WebInspector._monospaceFontFamily;}
  1240. WebInspector.isWorkerFrontend=function()
  1241. {return!!Runtime.queryParam("isSharedWorker");};WebInspector.UserMetrics=function()
  1242. {for(var actionName in WebInspector.UserMetrics._ActionCodes){var actionCode=WebInspector.UserMetrics._ActionCodes[actionName];this[actionName]=new WebInspector.UserMetrics._Recorder(actionCode);}}
  1243. WebInspector.UserMetrics._ActionCodes={WindowDocked:1,WindowUndocked:2,ScriptsBreakpointSet:3,TimelineStarted:4,ProfilesCPUProfileTaken:5,ProfilesHeapProfileTaken:6,AuditsStarted:7,ConsoleEvaluated:8,FileSavedInWorkspace:9,DeviceModeEnabled:10,AnimationsPlaybackRateChanged:11}
  1244. WebInspector.UserMetrics._PanelCodes={elements:1,resources:2,network:3,sources:4,timeline:5,profiles:6,audits:7,console:8}
  1245. WebInspector.UserMetrics.UserAction="UserAction";WebInspector.UserMetrics.UserActionNames={ForcedElementState:"forcedElementState",FileSaved:"fileSaved",RevertRevision:"revertRevision",ApplyOriginalContent:"applyOriginalContent",TogglePrettyPrint:"togglePrettyPrint",SetBreakpoint:"setBreakpoint",OpenSourceLink:"openSourceLink",NetworkSort:"networkSort",NetworkRequestSelected:"networkRequestSelected",NetworkRequestTabSelected:"networkRequestTabSelected",HeapSnapshotFilterChanged:"heapSnapshotFilterChanged"};WebInspector.UserMetrics.prototype={panelShown:function(panelName)
  1246. {InspectorFrontendHost.recordPanelShown(WebInspector.UserMetrics._PanelCodes[panelName]||0);}}
  1247. WebInspector.UserMetrics._Recorder=function(actionCode)
  1248. {this._actionCode=actionCode;}
  1249. WebInspector.UserMetrics._Recorder.prototype={record:function()
  1250. {InspectorFrontendHost.recordActionTaken(this._actionCode);}}
  1251. WebInspector.userMetrics=new WebInspector.UserMetrics();;function InspectorBackendClass()
  1252. {this._connection=null;this._agentPrototypes={};this._dispatcherPrototypes={};this._initialized=false;this._enums={};this._initProtocolAgentsConstructor();}
  1253. InspectorBackendClass._DevToolsErrorCode=-32000;InspectorBackendClass.prototype={_initProtocolAgentsConstructor:function()
  1254. {window.Protocol={};window.Protocol.Agents=function(agentsMap){this._agentsMap=agentsMap;};},_addAgentGetterMethodToProtocolAgentsPrototype:function(domain)
  1255. {var upperCaseLength=0;while(upperCaseLength<domain.length&&domain[upperCaseLength].toLowerCase()!==domain[upperCaseLength])
  1256. ++upperCaseLength;var methodName=domain.substr(0,upperCaseLength).toLowerCase()+domain.slice(upperCaseLength)+"Agent";function agentGetter()
  1257. {return this._agentsMap[domain];}
  1258. window.Protocol.Agents.prototype[methodName]=agentGetter;function registerDispatcher(dispatcher)
  1259. {this.registerDispatcher(domain,dispatcher)}
  1260. window.Protocol.Agents.prototype["register"+domain+"Dispatcher"]=registerDispatcher;},connection:function()
  1261. {if(!this._connection)
  1262. throw"Main connection was not initialized";return this._connection;},setConnection:function(connection)
  1263. {this._connection=connection;this._connection.registerAgentsOn(window);for(var type in this._enums){var domainAndMethod=type.split(".");window[domainAndMethod[0]+"Agent"][domainAndMethod[1]]=this._enums[type];}},_agentPrototype:function(domain)
  1264. {if(!this._agentPrototypes[domain]){this._agentPrototypes[domain]=new InspectorBackendClass.AgentPrototype(domain);this._addAgentGetterMethodToProtocolAgentsPrototype(domain);}
  1265. return this._agentPrototypes[domain];},_dispatcherPrototype:function(domain)
  1266. {if(!this._dispatcherPrototypes[domain])
  1267. this._dispatcherPrototypes[domain]=new InspectorBackendClass.DispatcherPrototype();return this._dispatcherPrototypes[domain];},registerCommand:function(method,signature,replyArgs,hasErrorData)
  1268. {var domainAndMethod=method.split(".");this._agentPrototype(domainAndMethod[0]).registerCommand(domainAndMethod[1],signature,replyArgs,hasErrorData);this._initialized=true;},registerEnum:function(type,values)
  1269. {this._enums[type]=values;this._initialized=true;},registerEvent:function(eventName,params)
  1270. {var domain=eventName.split(".")[0];this._dispatcherPrototype(domain).registerEvent(eventName,params);this._initialized=true;},loadFromJSONIfNeeded:function(jsonUrl)
  1271. {if(this._initialized)
  1272. return;var xhr=new XMLHttpRequest();xhr.open("GET",jsonUrl,false);xhr.send(null);var schema=JSON.parse(xhr.responseText);var code=InspectorBackendClass._generateCommands(schema);eval(code);},wrapClientCallback:function(clientCallback,errorPrefix,constructor,defaultValue)
  1273. {function callbackWrapper(error,value)
  1274. {if(error){console.error(errorPrefix+error);clientCallback(defaultValue);return;}
  1275. if(constructor)
  1276. clientCallback(new constructor(value));else
  1277. clientCallback(value);}
  1278. return callbackWrapper;}}
  1279. InspectorBackendClass._generateCommands=function(schema){var jsTypes={integer:"number",array:"object"};var rawTypes={};var result=[];var domains=schema["domains"]||[];for(var i=0;i<domains.length;++i){var domain=domains[i];for(var j=0;domain.types&&j<domain.types.length;++j){var type=domain.types[j];rawTypes[domain.domain+"."+type.id]=jsTypes[type.type]||type.type;}}
  1280. function toUpperCase(groupIndex,group0,group1)
  1281. {return[group0,group1][groupIndex].toUpperCase();}
  1282. function generateEnum(enumName,items)
  1283. {var members=[];for(var m=0;m<items.length;++m){var value=items[m];var name=value.replace(/-(\w)/g,toUpperCase.bind(null,1)).toTitleCase();name=name.replace(/HTML|XML|WML|API/ig,toUpperCase.bind(null,0));members.push(name+": \""+value+"\"");}
  1284. return"InspectorBackend.registerEnum(\""+enumName+"\", {"+members.join(", ")+"});";}
  1285. for(var i=0;i<domains.length;++i){var domain=domains[i];var types=domain["types"]||[];for(var j=0;j<types.length;++j){var type=types[j];if((type["type"]==="string")&&type["enum"])
  1286. result.push(generateEnum(domain.domain+"."+type.id,type["enum"]));else if(type["type"]==="object"){var properties=type["properties"]||[];for(var k=0;k<properties.length;++k){var property=properties[k];if((property["type"]==="string")&&property["enum"])
  1287. result.push(generateEnum(domain.domain+"."+type.id+property["name"].toTitleCase(),property["enum"]));}}}
  1288. var commands=domain["commands"]||[];for(var j=0;j<commands.length;++j){var command=commands[j];var parameters=command["parameters"];var paramsText=[];for(var k=0;parameters&&k<parameters.length;++k){var parameter=parameters[k];var type;if(parameter.type)
  1289. type=jsTypes[parameter.type]||parameter.type;else{var ref=parameter["$ref"];if(ref.indexOf(".")!==-1)
  1290. type=rawTypes[ref];else
  1291. type=rawTypes[domain.domain+"."+ref];}
  1292. var text="{\"name\": \""+parameter.name+"\", \"type\": \""+type+"\", \"optional\": "+(parameter.optional?"true":"false")+"}";paramsText.push(text);}
  1293. var returnsText=[];var returns=command["returns"]||[];for(var k=0;k<returns.length;++k){var parameter=returns[k];returnsText.push("\""+parameter.name+"\"");}
  1294. var hasErrorData=String(Boolean(command.error));result.push("InspectorBackend.registerCommand(\""+domain.domain+"."+command.name+"\", ["+paramsText.join(", ")+"], ["+returnsText.join(", ")+"], "+hasErrorData+");");}
  1295. for(var j=0;domain.events&&j<domain.events.length;++j){var event=domain.events[j];var paramsText=[];for(var k=0;event.parameters&&k<event.parameters.length;++k){var parameter=event.parameters[k];paramsText.push("\""+parameter.name+"\"");}
  1296. result.push("InspectorBackend.registerEvent(\""+domain.domain+"."+event.name+"\", ["+paramsText.join(", ")+"]);");}}
  1297. return result.join("\n");}
  1298. InspectorBackendClass.Connection=function()
  1299. {this._lastMessageId=1;this._pendingResponsesCount=0;this._agents={};this._dispatchers={};this._callbacks={};this._initialize(InspectorBackend._agentPrototypes,InspectorBackend._dispatcherPrototypes);this._isConnected=true;}
  1300. InspectorBackendClass.Connection.Events={Disconnected:"Disconnected",}
  1301. InspectorBackendClass.Connection.prototype={_initialize:function(agentPrototypes,dispatcherPrototypes)
  1302. {for(var domain in agentPrototypes){this._agents[domain]=Object.create(agentPrototypes[domain]);this._agents[domain].setConnection(this);}
  1303. for(var domain in dispatcherPrototypes)
  1304. this._dispatchers[domain]=Object.create(dispatcherPrototypes[domain]);},registerAgentsOn:function(object)
  1305. {for(var domain in this._agents)
  1306. object[domain+"Agent"]=this._agents[domain];},nextMessageId:function()
  1307. {return this._lastMessageId++;},agent:function(domain)
  1308. {return this._agents[domain];},agentsMap:function()
  1309. {return this._agents;},_wrapCallbackAndSendMessageObject:function(domain,method,params,callback)
  1310. {if(!this._isConnected&&callback){this._dispatchConnectionErrorResponse(domain,method,callback);return;}
  1311. var messageObject={};var messageId=this.nextMessageId();messageObject.id=messageId;messageObject.method=method;if(params)
  1312. messageObject.params=params;var wrappedCallback=this._wrap(callback,domain,method);if(InspectorBackendClass.Options.dumpInspectorProtocolMessages)
  1313. this._dumpProtocolMessage("frontend: "+JSON.stringify(messageObject));this.sendMessage(messageObject);++this._pendingResponsesCount;this._callbacks[messageId]=wrappedCallback;},_wrap:function(callback,domain,method)
  1314. {if(!callback)
  1315. callback=function(){};callback.methodName=method;callback.domain=domain;if(InspectorBackendClass.Options.dumpInspectorTimeStats)
  1316. callback.sendRequestTime=Date.now();return callback;},sendMessage:function(messageObject)
  1317. {throw"Not implemented";},reportProtocolError:function(messageObject)
  1318. {console.error("Protocol Error: the message with wrong id. Message =  "+JSON.stringify(messageObject));},dispatch:function(message)
  1319. {if(InspectorBackendClass.Options.dumpInspectorProtocolMessages)
  1320. this._dumpProtocolMessage("backend: "+((typeof message==="string")?message:JSON.stringify(message)));var messageObject=((typeof message==="string")?JSON.parse(message):message);if("id"in messageObject){var callback=this._callbacks[messageObject.id];if(!callback){this.reportProtocolError(messageObject);return;}
  1321. var processingStartTime;if(InspectorBackendClass.Options.dumpInspectorTimeStats)
  1322. processingStartTime=Date.now();this.agent(callback.domain).dispatchResponse(messageObject,callback.methodName,callback);--this._pendingResponsesCount;delete this._callbacks[messageObject.id];if(InspectorBackendClass.Options.dumpInspectorTimeStats)
  1323. console.log("time-stats: "+callback.methodName+" = "+(processingStartTime-callback.sendRequestTime)+" + "+(Date.now()-processingStartTime));if(this._scripts&&!this._pendingResponsesCount)
  1324. this.runAfterPendingDispatches();return;}else{var method=messageObject.method.split(".");var domainName=method[0];if(!(domainName in this._dispatchers)){console.error("Protocol Error: the message "+messageObject.method+" is for non-existing domain '"+domainName+"'");return;}
  1325. this._dispatchers[domainName].dispatch(method[1],messageObject);}},registerDispatcher:function(domain,dispatcher)
  1326. {if(!this._dispatchers[domain])
  1327. return;this._dispatchers[domain].setDomainDispatcher(dispatcher);},runAfterPendingDispatches:function(script)
  1328. {if(!this._scripts)
  1329. this._scripts=[];if(script)
  1330. this._scripts.push(script);setTimeout(function(){if(!this._pendingResponsesCount)
  1331. this._executeAfterPendingDispatches();else
  1332. this.runAfterPendingDispatches();}.bind(this),0);},_executeAfterPendingDispatches:function()
  1333. {if(!this._pendingResponsesCount){var scripts=this._scripts;this._scripts=[];for(var id=0;id<scripts.length;++id)
  1334. scripts[id].call(this);}},_dumpProtocolMessage:function(message)
  1335. {console.log(message);},connectionClosed:function(reason)
  1336. {this._isConnected=false;this._runPendingCallbacks();this.dispatchEventToListeners(InspectorBackendClass.Connection.Events.Disconnected,{reason:reason});},_runPendingCallbacks:function()
  1337. {var keys=Object.keys(this._callbacks).map(function(num){return parseInt(num,10);});for(var i=0;i<keys.length;++i){var callback=this._callbacks[keys[i]];this._dispatchConnectionErrorResponse(callback.domain,callback.methodName,callback);}
  1338. this._callbacks={};},_dispatchConnectionErrorResponse:function(domain,methodName,callback)
  1339. {var error={message:"Connection is closed",code:InspectorBackendClass._DevToolsErrorCode,data:null};var messageObject={error:error};setTimeout(InspectorBackendClass.AgentPrototype.prototype.dispatchResponse.bind(this.agent(domain),messageObject,methodName,callback),0);},isClosed:function()
  1340. {return!this._isConnected;},suppressErrorsForDomains:function(domains)
  1341. {domains.forEach(function(domain){this._agents[domain].suppressErrorLogging();},this);},__proto__:WebInspector.Object.prototype}
  1342. InspectorBackendClass.MainConnection=function()
  1343. {InspectorBackendClass.Connection.call(this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.DispatchMessage,this._dispatchMessage,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.DispatchMessageChunk,this._dispatchMessageChunk,this);}
  1344. InspectorBackendClass.MainConnection.prototype={sendMessage:function(messageObject)
  1345. {var message=JSON.stringify(messageObject);InspectorFrontendHost.sendMessageToBackend(message);},_dispatchMessage:function(event)
  1346. {this.dispatch((event.data));},_dispatchMessageChunk:function(event)
  1347. {var messageChunk=(event.data["messageChunk"]);var messageSize=(event.data["messageSize"]);if(messageSize){this._messageBuffer="";this._messageSize=messageSize;}
  1348. this._messageBuffer+=messageChunk;if(this._messageBuffer.length===this._messageSize){this.dispatch(this._messageBuffer);this._messageBuffer="";this._messageSize=0;}},__proto__:InspectorBackendClass.Connection.prototype}
  1349. InspectorBackendClass.WebSocketConnection=function(url,onConnectionReady)
  1350. {InspectorBackendClass.Connection.call(this);this._socket=new WebSocket(url);this._socket.onmessage=this._onMessage.bind(this);this._socket.onerror=this._onError.bind(this);this._socket.onopen=onConnectionReady.bind(null,this);this._socket.onclose=this.connectionClosed.bind(this,"websocket_closed");}
  1351. InspectorBackendClass.WebSocketConnection.Create=function(url,onConnectionReady)
  1352. {new InspectorBackendClass.WebSocketConnection(url,onConnectionReady);}
  1353. InspectorBackendClass.WebSocketConnection.prototype={_onMessage:function(message)
  1354. {var data=(message.data);this.dispatch(data);},_onError:function(error)
  1355. {console.error(error);},sendMessage:function(messageObject)
  1356. {var message=JSON.stringify(messageObject);this._socket.send(message);},__proto__:InspectorBackendClass.Connection.prototype}
  1357. InspectorBackendClass.StubConnection=function()
  1358. {InspectorBackendClass.Connection.call(this);}
  1359. InspectorBackendClass.StubConnection.prototype={sendMessage:function(messageObject)
  1360. {setTimeout(this._echoResponse.bind(this,messageObject),0);},_echoResponse:function(messageObject)
  1361. {this.dispatch(messageObject);},__proto__:InspectorBackendClass.Connection.prototype}
  1362. InspectorBackendClass.AgentPrototype=function(domain)
  1363. {this._replyArgs={};this._hasErrorData={};this._domain=domain;this._suppressErrorLogging=false;this._promisified=domain in InspectorBackendClass.AgentPrototype.PromisifiedDomains;}
  1364. InspectorBackendClass.AgentPrototype.PromisifiedDomains={"Profiler":true}
  1365. InspectorBackendClass.AgentPrototype.prototype={setConnection:function(connection)
  1366. {this._connection=connection;},registerCommand:function(methodName,signature,replyArgs,hasErrorData)
  1367. {var domainAndMethod=this._domain+"."+methodName;function sendMessage(vararg)
  1368. {var params=Array.prototype.slice.call(arguments);InspectorBackendClass.AgentPrototype.prototype._sendMessageToBackend.call(this,domainAndMethod,signature,params);}
  1369. function sendMessagePromise(vararg)
  1370. {var params=Array.prototype.slice.call(arguments);return InspectorBackendClass.AgentPrototype.prototype._sendMessageToBackendPromise.call(this,domainAndMethod,signature,replyArgs,params);}
  1371. this[methodName]=this._promisified?sendMessagePromise:sendMessage;function invoke(vararg)
  1372. {var params=[domainAndMethod].concat(Array.prototype.slice.call(arguments));InspectorBackendClass.AgentPrototype.prototype._invoke.apply(this,params);}
  1373. this["invoke_"+methodName]=invoke;this._replyArgs[domainAndMethod]=replyArgs;if(hasErrorData)
  1374. this._hasErrorData[domainAndMethod]=true;},_prepareParameters:function(method,signature,args,allowExtraUndefinedArg,errorCallback)
  1375. {var params={};var hasParams=false;for(var i=0;i<signature.length;++i){var param=signature[i];var paramName=param["name"];var typeName=param["type"];var optionalFlag=param["optional"];if(!args.length&&!optionalFlag){errorCallback("Protocol Error: Invalid number of arguments for method '"+method+"' call. It must have the following arguments '"+JSON.stringify(signature)+"'.");return null;}
  1376. var value=args.shift();if(optionalFlag&&typeof value==="undefined")
  1377. continue;if(typeof value!==typeName){errorCallback("Protocol Error: Invalid type of argument '"+paramName+"' for method '"+method+"' call. It must be '"+typeName+"' but it is '"+typeof value+"'.");return null;}
  1378. params[paramName]=value;hasParams=true;}
  1379. if(args.length===1&&(!allowExtraUndefinedArg||(typeof args[0]!=="undefined"))){errorCallback("Protocol Error: Optional callback argument for method '"+method+"' call must be a function but its type is '"+typeof args[0]+"'.");return null;}
  1380. if(args.length>1){errorCallback("Protocol Error: Extra "+args.length+" arguments in a call to method '"+method+"'.");return null;}
  1381. return hasParams?params:null},_sendMessageToBackend:function(method,signature,args)
  1382. {var errorMessage;function onError(message)
  1383. {console.error(message)
  1384. errorMessage=message;}
  1385. var callback=(args.length&&typeof args.peekLast()==="function")?args.pop():null;var params=this._prepareParameters(method,signature,args,!callback,onError);if(errorMessage)
  1386. return;this._connection._wrapCallbackAndSendMessageObject(this._domain,method,params,callback);},_sendMessageToBackendPromise:function(method,signature,replyArgs,args)
  1387. {var errorMessage;function onError(message)
  1388. {console.error(message)
  1389. errorMessage=message;}
  1390. var params=this._prepareParameters(method,signature,args,false,onError);if(errorMessage)
  1391. return Promise.reject(new Error(errorMessage));else
  1392. return new Promise(promiseAction.bind(this));function promiseAction(resolve,reject)
  1393. {function callback(error,result)
  1394. {if(error){console.error(error);resolve(null);return;}
  1395. resolve(replyArgs.length?result:undefined);}
  1396. this._connection._wrapCallbackAndSendMessageObject(this._domain,method,params,callback);}},_invoke:function(method,args,callback)
  1397. {this._connection._wrapCallbackAndSendMessageObject(this._domain,method,args,callback);},dispatchResponse:function(messageObject,methodName,callback)
  1398. {if(messageObject.error&&messageObject.error.code!==InspectorBackendClass._DevToolsErrorCode&&!InspectorBackendClass.Options.suppressRequestErrors&&!this._suppressErrorLogging)
  1399. console.error("Request with id = "+messageObject.id+" failed. "+JSON.stringify(messageObject.error));if(this._promisified){callback(messageObject.error&&messageObject.error.message,messageObject.result);return;}
  1400. var argumentsArray=[];argumentsArray[0]=messageObject.error?messageObject.error.message:null;if(this._hasErrorData[methodName])
  1401. argumentsArray[1]=messageObject.error?messageObject.error.data:null;if(messageObject.result){var paramNames=this._replyArgs[methodName]||[];for(var i=0;i<paramNames.length;++i)
  1402. argumentsArray.push(messageObject.result[paramNames[i]]);}
  1403. callback.apply(null,argumentsArray);},suppressErrorLogging:function()
  1404. {this._suppressErrorLogging=true;}}
  1405. InspectorBackendClass.DispatcherPrototype=function()
  1406. {this._eventArgs={};this._dispatcher=null;}
  1407. InspectorBackendClass.DispatcherPrototype.prototype={registerEvent:function(eventName,params)
  1408. {this._eventArgs[eventName]=params;},setDomainDispatcher:function(dispatcher)
  1409. {this._dispatcher=dispatcher;},dispatch:function(functionName,messageObject)
  1410. {if(!this._dispatcher)
  1411. return;if(!(functionName in this._dispatcher)){console.error("Protocol Error: Attempted to dispatch an unimplemented method '"+messageObject.method+"'");return;}
  1412. if(!this._eventArgs[messageObject.method]){console.error("Protocol Error: Attempted to dispatch an unspecified method '"+messageObject.method+"'");return;}
  1413. var params=[];if(messageObject.params){var paramNames=this._eventArgs[messageObject.method];for(var i=0;i<paramNames.length;++i)
  1414. params.push(messageObject.params[paramNames[i]]);}
  1415. var processingStartTime;if(InspectorBackendClass.Options.dumpInspectorTimeStats)
  1416. processingStartTime=Date.now();this._dispatcher[functionName].apply(this._dispatcher,params);if(InspectorBackendClass.Options.dumpInspectorTimeStats)
  1417. console.log("time-stats: "+messageObject.method+" = "+(Date.now()-processingStartTime));}}
  1418. InspectorBackendClass.Options={dumpInspectorTimeStats:false,dumpInspectorProtocolMessages:false,suppressRequestErrors:false}
  1419. InspectorBackend=new InspectorBackendClass();;InspectorBackend.registerEvent("Inspector.evaluateForTestInFrontend",["testCallId","script"]);InspectorBackend.registerEvent("Inspector.inspect",["object","hints"]);InspectorBackend.registerEvent("Inspector.detached",["reason"]);InspectorBackend.registerEvent("Inspector.targetCrashed",[]);InspectorBackend.registerCommand("Inspector.enable",[],[],false);InspectorBackend.registerCommand("Inspector.disable",[],[],false);InspectorBackend.registerCommand("Inspector.reset",[],[],false);InspectorBackend.registerCommand("Memory.getDOMCounters",[],["documents","nodes","jsEventListeners"],false);InspectorBackend.registerEnum("Page.ResourceType",{Document:"Document",Stylesheet:"Stylesheet",Image:"Image",Media:"Media",Font:"Font",Script:"Script",TextTrack:"TextTrack",XHR:"XHR",WebSocket:"WebSocket",Other:"Other"});InspectorBackend.registerEnum("Page.UsageItemId",{Filesystem:"filesystem",Database:"database",Appcache:"appcache",Indexeddatabase:"indexeddatabase"});InspectorBackend.registerEvent("Page.domContentEventFired",["timestamp"]);InspectorBackend.registerEvent("Page.loadEventFired",["timestamp"]);InspectorBackend.registerEvent("Page.frameAttached",["frameId","parentFrameId"]);InspectorBackend.registerEvent("Page.frameNavigated",["frame"]);InspectorBackend.registerEvent("Page.frameDetached",["frameId"]);InspectorBackend.registerEvent("Page.frameStartedLoading",["frameId"]);InspectorBackend.registerEvent("Page.frameStoppedLoading",["frameId"]);InspectorBackend.registerEvent("Page.frameScheduledNavigation",["frameId","delay"]);InspectorBackend.registerEvent("Page.frameClearedScheduledNavigation",["frameId"]);InspectorBackend.registerEvent("Page.frameResized",[]);InspectorBackend.registerEvent("Page.javascriptDialogOpening",["message"]);InspectorBackend.registerEvent("Page.javascriptDialogClosed",[]);InspectorBackend.registerEvent("Page.scriptsEnabled",["isEnabled"]);InspectorBackend.registerEvent("Page.screencastFrame",["data","metadata","frameNumber"]);InspectorBackend.registerEvent("Page.screencastVisibilityChanged",["visible"]);InspectorBackend.registerEvent("Page.viewportChanged",["viewport"]);InspectorBackend.registerEvent("Page.colorPicked",["color"]);InspectorBackend.registerEvent("Page.interstitialShown",[]);InspectorBackend.registerEvent("Page.interstitialHidden",[]);InspectorBackend.registerCommand("Page.enable",[],[],false);InspectorBackend.registerCommand("Page.disable",[],[],false);InspectorBackend.registerCommand("Page.addScriptToEvaluateOnLoad",[{"name":"scriptSource","type":"string","optional":false}],["identifier"],false);InspectorBackend.registerCommand("Page.removeScriptToEvaluateOnLoad",[{"name":"identifier","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.reload",[{"name":"ignoreCache","type":"boolean","optional":true},{"name":"scriptToEvaluateOnLoad","type":"string","optional":true},{"name":"scriptPreprocessor","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Page.navigate",[{"name":"url","type":"string","optional":false}],["frameId"],false);InspectorBackend.registerCommand("Page.getNavigationHistory",[],["currentIndex","entries"],false);InspectorBackend.registerCommand("Page.navigateToHistoryEntry",[{"name":"entryId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.getCookies",[],["cookies"],false);InspectorBackend.registerCommand("Page.deleteCookie",[{"name":"cookieName","type":"string","optional":false},{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.getResourceTree",[],["frameTree"],false);InspectorBackend.registerCommand("Page.getResourceContent",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false}],["content","base64Encoded"],false);InspectorBackend.registerCommand("Page.searchInResource",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false},{"name":"query","type":"string","optional":false},{"name":"caseSensitive","type":"boolean","optional":true},{"name":"isRegex","type":"boolean","optional":true}],["result"],false);InspectorBackend.registerCommand("Page.setDocumentContent",[{"name":"frameId","type":"string","optional":false},{"name":"html","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.setDeviceMetricsOverride",[{"name":"width","type":"number","optional":false},{"name":"height","type":"number","optional":false},{"name":"deviceScaleFactor","type":"number","optional":false},{"name":"mobile","type":"boolean","optional":false},{"name":"fitWindow","type":"boolean","optional":false},{"name":"scale","type":"number","optional":true},{"name":"offsetX","type":"number","optional":true},{"name":"offsetY","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.clearDeviceMetricsOverride",[],[],false);InspectorBackend.registerCommand("Page.resetScrollAndPageScaleFactor",[],[],false);InspectorBackend.registerCommand("Page.setPageScaleFactor",[{"name":"pageScaleFactor","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowPaintRects",[{"name":"result","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowDebugBorders",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowFPSCounter",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setContinuousPaintingEnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowScrollBottleneckRects",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.getScriptExecutionStatus",[],["result"],false);InspectorBackend.registerCommand("Page.setScriptExecutionDisabled",[{"name":"value","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setGeolocationOverride",[{"name":"latitude","type":"number","optional":true},{"name":"longitude","type":"number","optional":true},{"name":"accuracy","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.clearGeolocationOverride",[],[],false);InspectorBackend.registerCommand("Page.setDeviceOrientationOverride",[{"name":"alpha","type":"number","optional":false},{"name":"beta","type":"number","optional":false},{"name":"gamma","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.clearDeviceOrientationOverride",[],[],false);InspectorBackend.registerCommand("Page.setTouchEmulationEnabled",[{"name":"enabled","type":"boolean","optional":false},{"name":"configuration","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Page.setEmulatedMedia",[{"name":"media","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.captureScreenshot",[],["data"],false);InspectorBackend.registerCommand("Page.canScreencast",[],["result"],false);InspectorBackend.registerCommand("Page.canEmulate",[],["result"],false);InspectorBackend.registerCommand("Page.startScreencast",[{"name":"format","type":"string","optional":true},{"name":"quality","type":"number","optional":true},{"name":"maxWidth","type":"number","optional":true},{"name":"maxHeight","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.stopScreencast",[],[],false);InspectorBackend.registerCommand("Page.screencastFrameAck",[{"name":"frameNumber","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.startRecordingFrames",[{"name":"maxFrameCount","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.stopRecordingFrames",[],["frames"],false);InspectorBackend.registerCommand("Page.handleJavaScriptDialog",[{"name":"accept","type":"boolean","optional":false},{"name":"promptText","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Page.setShowViewportSizeOnResize",[{"name":"show","type":"boolean","optional":false},{"name":"showGrid","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Page.queryUsageAndQuota",[{"name":"securityOrigin","type":"string","optional":false}],["quota","usage"],false);InspectorBackend.registerCommand("Page.setColorPickerEnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setOverlayMessage",[{"name":"message","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Page.animationsPlaybackRate",[],["playbackRate"],false);InspectorBackend.registerCommand("Page.setAnimationsPlaybackRate",[{"name":"playbackRate","type":"number","optional":false}],[],false);InspectorBackend.registerEnum("Runtime.RemoteObjectType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean",Symbol:"symbol"});InspectorBackend.registerEnum("Runtime.RemoteObjectSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date",Map:"map",Set:"set",Iterator:"iterator",Generator:"generator"});InspectorBackend.registerEnum("Runtime.ObjectPreviewType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean",Symbol:"symbol"});InspectorBackend.registerEnum("Runtime.ObjectPreviewSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date",Map:"map",Set:"set",Iterator:"iterator",Generator:"generator"});InspectorBackend.registerEnum("Runtime.PropertyPreviewType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean",Symbol:"symbol",Accessor:"accessor"});InspectorBackend.registerEnum("Runtime.PropertyPreviewSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date",Map:"map",Set:"set",Iterator:"iterator",Generator:"generator"});InspectorBackend.registerEnum("Runtime.CallArgumentType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean",Symbol:"symbol"});InspectorBackend.registerEvent("Runtime.executionContextCreated",["context"]);InspectorBackend.registerEvent("Runtime.executionContextDestroyed",["executionContextId"]);InspectorBackend.registerEvent("Runtime.executionContextsCleared",[]);InspectorBackend.registerCommand("Runtime.evaluate",[{"name":"expression","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true},{"name":"includeCommandLineAPI","type":"boolean","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"contextId","type":"number","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown","exceptionDetails"],false);InspectorBackend.registerCommand("Runtime.callFunctionOn",[{"name":"objectId","type":"string","optional":false},{"name":"functionDeclaration","type":"string","optional":false},{"name":"arguments","type":"object","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Runtime.getProperties",[{"name":"objectId","type":"string","optional":false},{"name":"ownProperties","type":"boolean","optional":true},{"name":"accessorPropertiesOnly","type":"boolean","optional":true}],["result","internalProperties"],false);InspectorBackend.registerCommand("Runtime.releaseObject",[{"name":"objectId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Runtime.releaseObjectGroup",[{"name":"objectGroup","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Runtime.run",[],[],false);InspectorBackend.registerCommand("Runtime.enable",[],[],false);InspectorBackend.registerCommand("Runtime.disable",[],[],false);InspectorBackend.registerCommand("Runtime.isRunRequired",[],["result"],false);InspectorBackend.registerCommand("Runtime.setCustomObjectFormatterEnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerEnum("Console.ConsoleMessageSource",{XML:"xml",Javascript:"javascript",Network:"network",ConsoleAPI:"console-api",Storage:"storage",Appcache:"appcache",Rendering:"rendering",Css:"css",Security:"security",Other:"other",Deprecation:"deprecation"});InspectorBackend.registerEnum("Console.ConsoleMessageLevel",{Log:"log",Warning:"warning",Error:"error",Debug:"debug",Info:"info"});InspectorBackend.registerEnum("Console.ConsoleMessageType",{Log:"log",Dir:"dir",DirXML:"dirxml",Table:"table",Trace:"trace",Clear:"clear",StartGroup:"startGroup",StartGroupCollapsed:"startGroupCollapsed",EndGroup:"endGroup",Assert:"assert",Profile:"profile",ProfileEnd:"profileEnd"});InspectorBackend.registerEvent("Console.messageAdded",["message"]);InspectorBackend.registerEvent("Console.messageRepeatCountUpdated",["count","timestamp"]);InspectorBackend.registerEvent("Console.messagesCleared",[]);InspectorBackend.registerCommand("Console.enable",[],[],false);InspectorBackend.registerCommand("Console.disable",[],[],false);InspectorBackend.registerCommand("Console.clearMessages",[],[],false);InspectorBackend.registerCommand("Console.setMonitoringXHREnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Console.addInspectedNode",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Console.addInspectedHeapObject",[{"name":"heapObjectId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Console.setLastEvaluationResult",[{"name":"objectId","type":"string","optional":false}],[],false);InspectorBackend.registerEnum("Network.InitiatorType",{Parser:"parser",Script:"script",Other:"other"});InspectorBackend.registerEvent("Network.requestWillBeSent",["requestId","frameId","loaderId","documentURL","request","timestamp","initiator","redirectResponse","type"]);InspectorBackend.registerEvent("Network.requestServedFromCache",["requestId"]);InspectorBackend.registerEvent("Network.responseReceived",["requestId","frameId","loaderId","timestamp","type","response"]);InspectorBackend.registerEvent("Network.dataReceived",["requestId","timestamp","dataLength","encodedDataLength"]);InspectorBackend.registerEvent("Network.loadingFinished",["requestId","timestamp","encodedDataLength"]);InspectorBackend.registerEvent("Network.loadingFailed",["requestId","timestamp","type","errorText","canceled"]);InspectorBackend.registerEvent("Network.webSocketWillSendHandshakeRequest",["requestId","timestamp","request"]);InspectorBackend.registerEvent("Network.webSocketHandshakeResponseReceived",["requestId","timestamp","response"]);InspectorBackend.registerEvent("Network.webSocketCreated",["requestId","url"]);InspectorBackend.registerEvent("Network.webSocketClosed",["requestId","timestamp"]);InspectorBackend.registerEvent("Network.webSocketFrameReceived",["requestId","timestamp","response"]);InspectorBackend.registerEvent("Network.webSocketFrameError",["requestId","timestamp","errorMessage"]);InspectorBackend.registerEvent("Network.webSocketFrameSent",["requestId","timestamp","response"]);InspectorBackend.registerCommand("Network.enable",[],[],false);InspectorBackend.registerCommand("Network.disable",[],[],false);InspectorBackend.registerCommand("Network.setUserAgentOverride",[{"name":"userAgent","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Network.setExtraHTTPHeaders",[{"name":"headers","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("Network.getResponseBody",[{"name":"requestId","type":"string","optional":false}],["body","base64Encoded"],false);InspectorBackend.registerCommand("Network.replayXHR",[{"name":"requestId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Network.canClearBrowserCache",[],["result"],false);InspectorBackend.registerCommand("Network.clearBrowserCache",[],[],false);InspectorBackend.registerCommand("Network.canClearBrowserCookies",[],["result"],false);InspectorBackend.registerCommand("Network.clearBrowserCookies",[],[],false);InspectorBackend.registerCommand("Network.canEmulateNetworkConditions",[],["result"],false);InspectorBackend.registerCommand("Network.emulateNetworkConditions",[{"name":"offline","type":"boolean","optional":false},{"name":"latency","type":"number","optional":false},{"name":"downloadThroughput","type":"number","optional":false},{"name":"uploadThroughput","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Network.setCacheDisabled",[{"name":"cacheDisabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Network.loadResourceForFrontend",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false},{"name":"requestHeaders","type":"object","optional":true}],["statusCode","responseHeaders","content"],false);InspectorBackend.registerEvent("Database.addDatabase",["database"]);InspectorBackend.registerCommand("Database.enable",[],[],false);InspectorBackend.registerCommand("Database.disable",[],[],false);InspectorBackend.registerCommand("Database.getDatabaseTableNames",[{"name":"databaseId","type":"string","optional":false}],["tableNames"],false);InspectorBackend.registerCommand("Database.executeSQL",[{"name":"databaseId","type":"string","optional":false},{"name":"query","type":"string","optional":false}],["columnNames","values","sqlError"],false);InspectorBackend.registerEnum("IndexedDB.KeyType",{Number:"number",String:"string",Date:"date",Array:"array"});InspectorBackend.registerEnum("IndexedDB.KeyPathType",{Null:"null",String:"string",Array:"array"});InspectorBackend.registerCommand("IndexedDB.enable",[],[],false);InspectorBackend.registerCommand("IndexedDB.disable",[],[],false);InspectorBackend.registerCommand("IndexedDB.requestDatabaseNames",[{"name":"securityOrigin","type":"string","optional":false}],["databaseNames"],false);InspectorBackend.registerCommand("IndexedDB.requestDatabase",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false}],["databaseWithObjectStores"],false);InspectorBackend.registerCommand("IndexedDB.requestData",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false},{"name":"objectStoreName","type":"string","optional":false},{"name":"indexName","type":"string","optional":false},{"name":"skipCount","type":"number","optional":false},{"name":"pageSize","type":"number","optional":false},{"name":"keyRange","type":"object","optional":true}],["objectStoreDataEntries","hasMore"],false);InspectorBackend.registerCommand("IndexedDB.clearObjectStore",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false},{"name":"objectStoreName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("ServiceWorkerCache.requestCacheNames",[],["cacheNames"],false);InspectorBackend.registerCommand("ServiceWorkerCache.requestEntries",[{"name":"cacheName","type":"string","optional":false},{"name":"skipCount","type":"number","optional":false},{"name":"pageSize","type":"number","optional":false}],["cacheDataEntries","hasMore"],false);InspectorBackend.registerCommand("ServiceWorkerCache.deleteCache",[{"name":"cacheName","type":"string","optional":false}],[],false);InspectorBackend.registerEvent("DOMStorage.domStorageItemsCleared",["storageId"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemRemoved",["storageId","key"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemAdded",["storageId","key","newValue"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemUpdated",["storageId","key","oldValue","newValue"]);InspectorBackend.registerCommand("DOMStorage.enable",[],[],false);InspectorBackend.registerCommand("DOMStorage.disable",[],[],false);InspectorBackend.registerCommand("DOMStorage.getDOMStorageItems",[{"name":"storageId","type":"object","optional":false}],["entries"],false);InspectorBackend.registerCommand("DOMStorage.setDOMStorageItem",[{"name":"storageId","type":"object","optional":false},{"name":"key","type":"string","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMStorage.removeDOMStorageItem",[{"name":"storageId","type":"object","optional":false},{"name":"key","type":"string","optional":false}],[],false);InspectorBackend.registerEvent("ApplicationCache.applicationCacheStatusUpdated",["frameId","manifestURL","status"]);InspectorBackend.registerEvent("ApplicationCache.networkStateUpdated",["isNowOnline"]);InspectorBackend.registerCommand("ApplicationCache.getFramesWithManifests",[],["frameIds"],false);InspectorBackend.registerCommand("ApplicationCache.enable",[],[],false);InspectorBackend.registerCommand("ApplicationCache.getManifestForFrame",[{"name":"frameId","type":"string","optional":false}],["manifestURL"],false);InspectorBackend.registerCommand("ApplicationCache.getApplicationCacheForFrame",[{"name":"frameId","type":"string","optional":false}],["applicationCache"],false);InspectorBackend.registerCommand("FileSystem.enable",[],[],false);InspectorBackend.registerCommand("FileSystem.disable",[],[],false);InspectorBackend.registerCommand("FileSystem.requestFileSystemRoot",[{"name":"origin","type":"string","optional":false},{"name":"type","type":"string","optional":false}],["errorCode","root"],false);InspectorBackend.registerCommand("FileSystem.requestDirectoryContent",[{"name":"url","type":"string","optional":false}],["errorCode","entries"],false);InspectorBackend.registerCommand("FileSystem.requestMetadata",[{"name":"url","type":"string","optional":false}],["errorCode","metadata"],false);InspectorBackend.registerCommand("FileSystem.requestFileContent",[{"name":"url","type":"string","optional":false},{"name":"readAsText","type":"boolean","optional":false},{"name":"start","type":"number","optional":true},{"name":"end","type":"number","optional":true},{"name":"charset","type":"string","optional":true}],["errorCode","content","charset"],false);InspectorBackend.registerCommand("FileSystem.deleteEntry",[{"name":"url","type":"string","optional":false}],["errorCode"],false);InspectorBackend.registerEnum("DOM.PseudoType",{Before:"before",After:"after"});InspectorBackend.registerEnum("DOM.ShadowRootType",{UserAgent:"user-agent",Author:"author"});InspectorBackend.registerEvent("DOM.documentUpdated",[]);InspectorBackend.registerEvent("DOM.inspectNodeRequested",["nodeId"]);InspectorBackend.registerEvent("DOM.setChildNodes",["parentId","nodes"]);InspectorBackend.registerEvent("DOM.attributeModified",["nodeId","name","value"]);InspectorBackend.registerEvent("DOM.attributeRemoved",["nodeId","name"]);InspectorBackend.registerEvent("DOM.inlineStyleInvalidated",["nodeIds"]);InspectorBackend.registerEvent("DOM.shadowHostDistributionInvalidated",["nodeIds"]);InspectorBackend.registerEvent("DOM.characterDataModified",["nodeId","characterData"]);InspectorBackend.registerEvent("DOM.childNodeCountUpdated",["nodeId","childNodeCount"]);InspectorBackend.registerEvent("DOM.childNodeInserted",["parentNodeId","previousNodeId","node"]);InspectorBackend.registerEvent("DOM.childNodeRemoved",["parentNodeId","nodeId"]);InspectorBackend.registerEvent("DOM.shadowRootPushed",["hostId","root"]);InspectorBackend.registerEvent("DOM.shadowRootPopped",["hostId","rootId"]);InspectorBackend.registerEvent("DOM.pseudoElementAdded",["parentId","pseudoElement"]);InspectorBackend.registerEvent("DOM.pseudoElementRemoved",["parentId","pseudoElementId"]);InspectorBackend.registerCommand("DOM.enable",[],[],false);InspectorBackend.registerCommand("DOM.disable",[],[],false);InspectorBackend.registerCommand("DOM.getDocument",[],["root"],false);InspectorBackend.registerCommand("DOM.requestChildNodes",[{"name":"nodeId","type":"number","optional":false},{"name":"depth","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("DOM.requestShadowHostDistributedNodes",[{"name":"nodeId","type":"number","optional":false}],["insertionPointDistributions"],false);InspectorBackend.registerCommand("DOM.querySelector",[{"name":"nodeId","type":"number","optional":false},{"name":"selector","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.querySelectorAll",[{"name":"nodeId","type":"number","optional":false},{"name":"selector","type":"string","optional":false}],["nodeIds"],false);InspectorBackend.registerCommand("DOM.setNodeName",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.setNodeValue",[{"name":"nodeId","type":"number","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.removeNode",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setAttributeValue",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setAttributesAsText",[{"name":"nodeId","type":"number","optional":false},{"name":"text","type":"string","optional":false},{"name":"name","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("DOM.removeAttribute",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.getEventListenersForNode",[{"name":"nodeId","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["listeners"],false);InspectorBackend.registerCommand("DOM.getOuterHTML",[{"name":"nodeId","type":"number","optional":false}],["outerHTML"],false);InspectorBackend.registerCommand("DOM.setOuterHTML",[{"name":"nodeId","type":"number","optional":false},{"name":"outerHTML","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.performSearch",[{"name":"query","type":"string","optional":false},{"name":"includeUserAgentShadowDOM","type":"boolean","optional":true}],["searchId","resultCount"],false);InspectorBackend.registerCommand("DOM.getSearchResults",[{"name":"searchId","type":"string","optional":false},{"name":"fromIndex","type":"number","optional":false},{"name":"toIndex","type":"number","optional":false}],["nodeIds"],false);InspectorBackend.registerCommand("DOM.discardSearchResults",[{"name":"searchId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.requestNode",[{"name":"objectId","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.setInspectModeEnabled",[{"name":"enabled","type":"boolean","optional":false},{"name":"inspectUAShadowDOM","type":"boolean","optional":true},{"name":"highlightConfig","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightRect",[{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"width","type":"number","optional":false},{"name":"height","type":"number","optional":false},{"name":"color","type":"object","optional":true},{"name":"outlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightQuad",[{"name":"quad","type":"object","optional":false},{"name":"color","type":"object","optional":true},{"name":"outlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightNode",[{"name":"highlightConfig","type":"object","optional":false},{"name":"nodeId","type":"number","optional":true},{"name":"objectId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("DOM.hideHighlight",[],[],false);InspectorBackend.registerCommand("DOM.highlightFrame",[{"name":"frameId","type":"string","optional":false},{"name":"contentColor","type":"object","optional":true},{"name":"contentOutlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.pushNodeByPathToFrontend",[{"name":"path","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.pushNodesByBackendIdsToFrontend",[{"name":"backendNodeIds","type":"object","optional":false}],["nodeIds"],false);InspectorBackend.registerCommand("DOM.resolveNode",[{"name":"nodeId","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["object"],false);InspectorBackend.registerCommand("DOM.getAttributes",[{"name":"nodeId","type":"number","optional":false}],["attributes"],false);InspectorBackend.registerCommand("DOM.copyTo",[{"name":"nodeId","type":"number","optional":false},{"name":"targetNodeId","type":"number","optional":false},{"name":"insertBeforeNodeId","type":"number","optional":true}],["nodeId"],false);InspectorBackend.registerCommand("DOM.moveTo",[{"name":"nodeId","type":"number","optional":false},{"name":"targetNodeId","type":"number","optional":false},{"name":"insertBeforeNodeId","type":"number","optional":true}],["nodeId"],false);InspectorBackend.registerCommand("DOM.undo",[],[],false);InspectorBackend.registerCommand("DOM.redo",[],[],false);InspectorBackend.registerCommand("DOM.markUndoableState",[],[],false);InspectorBackend.registerCommand("DOM.focus",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setFileInputFiles",[{"name":"nodeId","type":"number","optional":false},{"name":"files","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("DOM.getBoxModel",[{"name":"nodeId","type":"number","optional":false}],["model"],false);InspectorBackend.registerCommand("DOM.getNodeForLocation",[{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.getRelayoutBoundary",[{"name":"nodeId","type":"number","optional":false}],["nodeId"],false);InspectorBackend.registerEnum("CSS.StyleSheetOrigin",{Injected:"injected",UserAgent:"user-agent",Inspector:"inspector",Regular:"regular"});InspectorBackend.registerEnum("CSS.CSSMediaSource",{MediaRule:"mediaRule",ImportRule:"importRule",LinkedSheet:"linkedSheet",InlineSheet:"inlineSheet"});InspectorBackend.registerEvent("CSS.mediaQueryResultChanged",[]);InspectorBackend.registerEvent("CSS.styleSheetChanged",["styleSheetId"]);InspectorBackend.registerEvent("CSS.styleSheetAdded",["header"]);InspectorBackend.registerEvent("CSS.styleSheetRemoved",["styleSheetId"]);InspectorBackend.registerCommand("CSS.enable",[],[],false);InspectorBackend.registerCommand("CSS.disable",[],[],false);InspectorBackend.registerCommand("CSS.getMatchedStylesForNode",[{"name":"nodeId","type":"number","optional":false},{"name":"excludePseudo","type":"boolean","optional":true},{"name":"excludeInherited","type":"boolean","optional":true}],["matchedCSSRules","pseudoElements","inherited"],false);InspectorBackend.registerCommand("CSS.getInlineStylesForNode",[{"name":"nodeId","type":"number","optional":false}],["inlineStyle","attributesStyle"],false);InspectorBackend.registerCommand("CSS.getComputedStyleForNode",[{"name":"nodeId","type":"number","optional":false}],["computedStyle"],false);InspectorBackend.registerCommand("CSS.getPlatformFontsForNode",[{"name":"nodeId","type":"number","optional":false}],["cssFamilyName","fonts"],false);InspectorBackend.registerCommand("CSS.getStyleSheetText",[{"name":"styleSheetId","type":"string","optional":false}],["text"],false);InspectorBackend.registerCommand("CSS.setStyleSheetText",[{"name":"styleSheetId","type":"string","optional":false},{"name":"text","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("CSS.setPropertyText",[{"name":"styleSheetId","type":"string","optional":false},{"name":"range","type":"object","optional":false},{"name":"text","type":"string","optional":false}],["style"],false);InspectorBackend.registerCommand("CSS.setRuleSelector",[{"name":"styleSheetId","type":"string","optional":false},{"name":"range","type":"object","optional":false},{"name":"selector","type":"string","optional":false}],["rule"],false);InspectorBackend.registerCommand("CSS.setMediaText",[{"name":"styleSheetId","type":"string","optional":false},{"name":"range","type":"object","optional":false},{"name":"text","type":"string","optional":false}],["media"],false);InspectorBackend.registerCommand("CSS.createStyleSheet",[{"name":"frameId","type":"string","optional":false}],["styleSheetId"],false);InspectorBackend.registerCommand("CSS.addRule",[{"name":"styleSheetId","type":"string","optional":false},{"name":"ruleText","type":"string","optional":false},{"name":"location","type":"object","optional":false}],["rule"],false);InspectorBackend.registerCommand("CSS.forcePseudoState",[{"name":"nodeId","type":"number","optional":false},{"name":"forcedPseudoClasses","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("CSS.getMediaQueries",[],["medias"],false);InspectorBackend.registerEvent("Timeline.eventRecorded",["record"]);InspectorBackend.registerEvent("Timeline.progress",["count"]);InspectorBackend.registerEvent("Timeline.started",["consoleTimeline"]);InspectorBackend.registerEvent("Timeline.stopped",["consoleTimeline","events"]);InspectorBackend.registerCommand("Timeline.enable",[],[],false);InspectorBackend.registerCommand("Timeline.disable",[],[],false);InspectorBackend.registerCommand("Timeline.start",[{"name":"maxCallStackDepth","type":"number","optional":true},{"name":"bufferEvents","type":"boolean","optional":true},{"name":"liveEvents","type":"string","optional":true},{"name":"includeCounters","type":"boolean","optional":true},{"name":"includeGPUEvents","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Timeline.stop",[],[],false);InspectorBackend.registerEnum("Debugger.GeneratorObjectDetailsStatus",{Running:"running",Suspended:"suspended",Closed:"closed"});InspectorBackend.registerEnum("Debugger.ScopeType",{Global:"global",Local:"local",With:"with",Closure:"closure",Catch:"catch",Block:"block",Script:"script"});InspectorBackend.registerEnum("Debugger.PromiseDetailsStatus",{Pending:"pending",Resolved:"resolved",Rejected:"rejected"});InspectorBackend.registerEvent("Debugger.globalObjectCleared",[]);InspectorBackend.registerEvent("Debugger.scriptParsed",["scriptId","url","startLine","startColumn","endLine","endColumn","isContentScript","sourceMapURL","hasSourceURL","context_data"]);InspectorBackend.registerEvent("Debugger.scriptFailedToParse",["scriptId","url","startLine","startColumn","endLine","endColumn","isContentScript","sourceMapURL","hasSourceURL"]);InspectorBackend.registerEvent("Debugger.breakpointResolved",["breakpointId","location"]);InspectorBackend.registerEvent("Debugger.paused",["callFrames","reason","data","hitBreakpoints","asyncStackTrace"]);InspectorBackend.registerEvent("Debugger.resumed",[]);InspectorBackend.registerCommand("Debugger.enable",[],[],false);InspectorBackend.registerCommand("Debugger.disable",[],[],false);InspectorBackend.registerCommand("Debugger.setBreakpointsActive",[{"name":"active","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.setSkipAllPauses",[{"name":"skipped","type":"boolean","optional":false},{"name":"untilReload","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.setBreakpointByUrl",[{"name":"lineNumber","type":"number","optional":false},{"name":"url","type":"string","optional":true},{"name":"urlRegex","type":"string","optional":true},{"name":"columnNumber","type":"number","optional":true},{"name":"condition","type":"string","optional":true}],["breakpointId","locations"],false);InspectorBackend.registerCommand("Debugger.setBreakpoint",[{"name":"location","type":"object","optional":false},{"name":"condition","type":"string","optional":true}],["breakpointId","actualLocation"],false);InspectorBackend.registerCommand("Debugger.removeBreakpoint",[{"name":"breakpointId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.continueToLocation",[{"name":"location","type":"object","optional":false},{"name":"interstatementLocation","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.stepOver",[],[],false);InspectorBackend.registerCommand("Debugger.stepInto",[],[],false);InspectorBackend.registerCommand("Debugger.stepOut",[],[],false);InspectorBackend.registerCommand("Debugger.pause",[],[],false);InspectorBackend.registerCommand("Debugger.resume",[],[],false);InspectorBackend.registerCommand("Debugger.stepIntoAsync",[],[],false);InspectorBackend.registerCommand("Debugger.searchInContent",[{"name":"scriptId","type":"string","optional":false},{"name":"query","type":"string","optional":false},{"name":"caseSensitive","type":"boolean","optional":true},{"name":"isRegex","type":"boolean","optional":true}],["result"],false);InspectorBackend.registerCommand("Debugger.canSetScriptSource",[],["result"],false);InspectorBackend.registerCommand("Debugger.setScriptSource",[{"name":"scriptId","type":"string","optional":false},{"name":"scriptSource","type":"string","optional":false},{"name":"preview","type":"boolean","optional":true}],["callFrames","result","asyncStackTrace"],true);InspectorBackend.registerCommand("Debugger.restartFrame",[{"name":"callFrameId","type":"string","optional":false}],["callFrames","result","asyncStackTrace"],false);InspectorBackend.registerCommand("Debugger.getScriptSource",[{"name":"scriptId","type":"string","optional":false}],["scriptSource"],false);InspectorBackend.registerCommand("Debugger.getFunctionDetails",[{"name":"functionId","type":"string","optional":false}],["details"],false);InspectorBackend.registerCommand("Debugger.getGeneratorObjectDetails",[{"name":"objectId","type":"string","optional":false}],["details"],false);InspectorBackend.registerCommand("Debugger.getCollectionEntries",[{"name":"objectId","type":"string","optional":false}],["entries"],false);InspectorBackend.registerCommand("Debugger.setPauseOnExceptions",[{"name":"state","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.evaluateOnCallFrame",[{"name":"callFrameId","type":"string","optional":false},{"name":"expression","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true},{"name":"includeCommandLineAPI","type":"boolean","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown","exceptionDetails"],false);InspectorBackend.registerCommand("Debugger.compileScript",[{"name":"expression","type":"string","optional":false},{"name":"sourceURL","type":"string","optional":false},{"name":"executionContextId","type":"number","optional":true}],["scriptId","exceptionDetails"],false);InspectorBackend.registerCommand("Debugger.runScript",[{"name":"scriptId","type":"string","optional":false},{"name":"executionContextId","type":"number","optional":true},{"name":"objectGroup","type":"string","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true}],["result","exceptionDetails"],false);InspectorBackend.registerCommand("Debugger.setVariableValue",[{"name":"scopeNumber","type":"number","optional":false},{"name":"variableName","type":"string","optional":false},{"name":"newValue","type":"object","optional":false},{"name":"callFrameId","type":"string","optional":true},{"name":"functionObjectId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.getStepInPositions",[{"name":"callFrameId","type":"string","optional":false}],["stepInPositions"],false);InspectorBackend.registerCommand("Debugger.getBacktrace",[],["callFrames","asyncStackTrace"],false);InspectorBackend.registerCommand("Debugger.skipStackFrames",[{"name":"script","type":"string","optional":true},{"name":"skipContentScripts","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.setAsyncCallStackDepth",[{"name":"maxDepth","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.enablePromiseTracker",[{"name":"captureStacks","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.disablePromiseTracker",[],[],false);InspectorBackend.registerCommand("Debugger.getPromises",[],["promises"],false);InspectorBackend.registerCommand("Debugger.getPromiseById",[{"name":"promiseId","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["promise"],false);InspectorBackend.registerEnum("DOMDebugger.DOMBreakpointType",{SubtreeModified:"subtree-modified",AttributeModified:"attribute-modified",NodeRemoved:"node-removed"});InspectorBackend.registerCommand("DOMDebugger.setDOMBreakpoint",[{"name":"nodeId","type":"number","optional":false},{"name":"type","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeDOMBreakpoint",[{"name":"nodeId","type":"number","optional":false},{"name":"type","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.setEventListenerBreakpoint",[{"name":"eventName","type":"string","optional":false},{"name":"targetName","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeEventListenerBreakpoint",[{"name":"eventName","type":"string","optional":false},{"name":"targetName","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("DOMDebugger.setInstrumentationBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeInstrumentationBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.setXHRBreakpoint",[{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeXHRBreakpoint",[{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerEvent("Profiler.consoleProfileStarted",["id","location","title"]);InspectorBackend.registerEvent("Profiler.consoleProfileFinished",["id","location","profile","title"]);InspectorBackend.registerCommand("Profiler.enable",[],[],false);InspectorBackend.registerCommand("Profiler.disable",[],[],false);InspectorBackend.registerCommand("Profiler.setSamplingInterval",[{"name":"interval","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Profiler.start",[],[],false);InspectorBackend.registerCommand("Profiler.stop",[],["profile"],false);InspectorBackend.registerEvent("HeapProfiler.addHeapSnapshotChunk",["chunk"]);InspectorBackend.registerEvent("HeapProfiler.resetProfiles",[]);InspectorBackend.registerEvent("HeapProfiler.reportHeapSnapshotProgress",["done","total","finished"]);InspectorBackend.registerEvent("HeapProfiler.lastSeenObjectId",["lastSeenObjectId","timestamp"]);InspectorBackend.registerEvent("HeapProfiler.heapStatsUpdate",["statsUpdate"]);InspectorBackend.registerCommand("HeapProfiler.enable",[],[],false);InspectorBackend.registerCommand("HeapProfiler.disable",[],[],false);InspectorBackend.registerCommand("HeapProfiler.startTrackingHeapObjects",[{"name":"trackAllocations","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("HeapProfiler.stopTrackingHeapObjects",[{"name":"reportProgress","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("HeapProfiler.takeHeapSnapshot",[{"name":"reportProgress","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("HeapProfiler.collectGarbage",[],[],false);InspectorBackend.registerCommand("HeapProfiler.getObjectByHeapObjectId",[{"name":"objectId","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true}],["result"],false);InspectorBackend.registerCommand("HeapProfiler.getHeapObjectId",[{"name":"objectId","type":"string","optional":false}],["heapSnapshotObjectId"],false);InspectorBackend.registerEvent("Worker.workerCreated",["workerId","url","inspectorConnected"]);InspectorBackend.registerEvent("Worker.workerTerminated",["workerId"]);InspectorBackend.registerEvent("Worker.dispatchMessageFromWorker",["workerId","message"]);InspectorBackend.registerEvent("Worker.disconnectedFromWorker",[]);InspectorBackend.registerCommand("Worker.enable",[],[],false);InspectorBackend.registerCommand("Worker.disable",[],[],false);InspectorBackend.registerCommand("Worker.sendMessageToWorker",[{"name":"workerId","type":"number","optional":false},{"name":"message","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("Worker.canInspectWorkers",[],["result"],false);InspectorBackend.registerCommand("Worker.connectToWorker",[{"name":"workerId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Worker.disconnectFromWorker",[{"name":"workerId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Worker.setAutoconnectToWorkers",[{"name":"value","type":"boolean","optional":false}],[],false);InspectorBackend.registerEnum("Canvas.CallArgumentType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean"});InspectorBackend.registerEnum("Canvas.CallArgumentSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date",Map:"map",Set:"set",Iterator:"iterator",Generator:"generator"});InspectorBackend.registerEvent("Canvas.contextCreated",["frameId"]);InspectorBackend.registerEvent("Canvas.traceLogsRemoved",["frameId","traceLogId"]);InspectorBackend.registerCommand("Canvas.enable",[],[],false);InspectorBackend.registerCommand("Canvas.disable",[],[],false);InspectorBackend.registerCommand("Canvas.dropTraceLog",[{"name":"traceLogId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Canvas.hasUninstrumentedCanvases",[],["result"],false);InspectorBackend.registerCommand("Canvas.captureFrame",[{"name":"frameId","type":"string","optional":true}],["traceLogId"],false);InspectorBackend.registerCommand("Canvas.startCapturing",[{"name":"frameId","type":"string","optional":true}],["traceLogId"],false);InspectorBackend.registerCommand("Canvas.stopCapturing",[{"name":"traceLogId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Canvas.getTraceLog",[{"name":"traceLogId","type":"string","optional":false},{"name":"startOffset","type":"number","optional":true},{"name":"maxLength","type":"number","optional":true}],["traceLog"],false);InspectorBackend.registerCommand("Canvas.replayTraceLog",[{"name":"traceLogId","type":"string","optional":false},{"name":"stepNo","type":"number","optional":false}],["resourceState","replayTime"],false);InspectorBackend.registerCommand("Canvas.getResourceState",[{"name":"traceLogId","type":"string","optional":false},{"name":"resourceId","type":"string","optional":false}],["resourceState"],false);InspectorBackend.registerCommand("Canvas.evaluateTraceLogCallArgument",[{"name":"traceLogId","type":"string","optional":false},{"name":"callIndex","type":"number","optional":false},{"name":"argumentIndex","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["result","resourceState"],false);InspectorBackend.registerEnum("Input.TouchPointState",{TouchPressed:"touchPressed",TouchReleased:"touchReleased",TouchMoved:"touchMoved",TouchStationary:"touchStationary",TouchCancelled:"touchCancelled"});InspectorBackend.registerCommand("Input.dispatchKeyEvent",[{"name":"type","type":"string","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true},{"name":"text","type":"string","optional":true},{"name":"unmodifiedText","type":"string","optional":true},{"name":"keyIdentifier","type":"string","optional":true},{"name":"windowsVirtualKeyCode","type":"number","optional":true},{"name":"nativeVirtualKeyCode","type":"number","optional":true},{"name":"autoRepeat","type":"boolean","optional":true},{"name":"isKeypad","type":"boolean","optional":true},{"name":"isSystemKey","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Input.dispatchMouseEvent",[{"name":"type","type":"string","optional":false},{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true},{"name":"button","type":"string","optional":true},{"name":"clickCount","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Input.dispatchTouchEvent",[{"name":"type","type":"string","optional":false},{"name":"touchPoints","type":"object","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Input.emulateTouchFromMouseEvent",[{"name":"type","type":"string","optional":false},{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"timestamp","type":"number","optional":false},{"name":"button","type":"string","optional":false},{"name":"deltaX","type":"number","optional":true},{"name":"deltaY","type":"number","optional":true},{"name":"modifiers","type":"number","optional":true},{"name":"clickCount","type":"number","optional":true}],[],false);InspectorBackend.registerEnum("LayerTree.ScrollRectType",{RepaintsOnScroll:"RepaintsOnScroll",TouchEventHandler:"TouchEventHandler",WheelEventHandler:"WheelEventHandler"});InspectorBackend.registerEvent("LayerTree.layerTreeDidChange",["layers"]);InspectorBackend.registerEvent("LayerTree.layerPainted",["layerId","clip"]);InspectorBackend.registerCommand("LayerTree.enable",[],[],false);InspectorBackend.registerCommand("LayerTree.disable",[],[],false);InspectorBackend.registerCommand("LayerTree.compositingReasons",[{"name":"layerId","type":"string","optional":false}],["compositingReasons"],false);InspectorBackend.registerCommand("LayerTree.makeSnapshot",[{"name":"layerId","type":"string","optional":false}],["snapshotId"],false);InspectorBackend.registerCommand("LayerTree.loadSnapshot",[{"name":"tiles","type":"object","optional":false}],["snapshotId"],false);InspectorBackend.registerCommand("LayerTree.releaseSnapshot",[{"name":"snapshotId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("LayerTree.profileSnapshot",[{"name":"snapshotId","type":"string","optional":false},{"name":"minRepeatCount","type":"number","optional":true},{"name":"minDuration","type":"number","optional":true},{"name":"clipRect","type":"object","optional":true}],["timings"],false);InspectorBackend.registerCommand("LayerTree.replaySnapshot",[{"name":"snapshotId","type":"string","optional":false},{"name":"fromStep","type":"number","optional":true},{"name":"toStep","type":"number","optional":true},{"name":"scale","type":"number","optional":true}],["dataURL"],false);InspectorBackend.registerCommand("LayerTree.snapshotCommandLog",[{"name":"snapshotId","type":"string","optional":false}],["commandLog"],false);InspectorBackend.registerCommand("DeviceOrientation.setDeviceOrientationOverride",[{"name":"alpha","type":"number","optional":false},{"name":"beta","type":"number","optional":false},{"name":"gamma","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("DeviceOrientation.clearDeviceOrientationOverride",[],[],false);InspectorBackend.registerEvent("Tracing.dataCollected",["value"]);InspectorBackend.registerEvent("Tracing.tracingComplete",[]);InspectorBackend.registerEvent("Tracing.bufferUsage",["percentFull","eventCount","value"]);InspectorBackend.registerCommand("Tracing.start",[{"name":"categories","type":"string","optional":true},{"name":"options","type":"string","optional":true},{"name":"bufferUsageReportingInterval","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Tracing.end",[],[],false);InspectorBackend.registerCommand("Tracing.getCategories",[],["categories"],false);InspectorBackend.registerEvent("Power.dataAvailable",["value"]);InspectorBackend.registerCommand("Power.start",[],[],false);InspectorBackend.registerCommand("Power.end",[],[],false);InspectorBackend.registerCommand("Power.canProfilePower",[],["result"],false);InspectorBackend.registerCommand("Power.getAccuracyLevel",[],["result"],false);InspectorBackend.registerEvent("Animation.animationPlayerCreated",["player"]);InspectorBackend.registerCommand("Animation.enable",[],[],false);InspectorBackend.registerCommand("Animation.getAnimationPlayersForNode",[{"name":"nodeId","type":"number","optional":false},{"name":"includeSubtreeAnimations","type":"boolean","optional":false}],["animationPlayers"],false);InspectorBackend.registerCommand("Animation.pauseAnimationPlayer",[{"name":"id","type":"string","optional":false}],["animationPlayer"],false);InspectorBackend.registerCommand("Animation.playAnimationPlayer",[{"name":"id","type":"string","optional":false}],["animationPlayer"],false);InspectorBackend.registerCommand("Animation.setAnimationPlayerCurrentTime",[{"name":"id","type":"string","optional":false},{"name":"currentTime","type":"number","optional":false}],["animationPlayer"],false);InspectorBackend.registerCommand("Animation.getAnimationPlayerState",[{"name":"id","type":"string","optional":false}],["currentTime","isRunning"],false);InspectorBackend.registerCommand("Animation.startListening",[{"name":"nodeId","type":"number","optional":false},{"name":"includeSubtreeAnimations","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Animation.stopListening",[],[],false);;WebInspector.Target=function(name,connection,callback)
  1420. {Protocol.Agents.call(this,connection.agentsMap());this._name=name;this._connection=connection;connection.addEventListener(InspectorBackendClass.Connection.Events.Disconnected,this._onDisconnect,this);this._id=WebInspector.Target._nextId++;this._modelByConstructor=new Map();this._capabilities={};this.pageAgent().canScreencast(this._initializeCapability.bind(this,WebInspector.Target.Capabilities.CanScreencast,null));this.pageAgent().canEmulate(this._initializeCapability.bind(this,WebInspector.Target.Capabilities.CanEmulate,null));if(Runtime.experiments.isEnabled("timelinePowerProfiler"))
  1421. this.powerAgent().canProfilePower(this._initializeCapability.bind(this,WebInspector.Target.Capabilities.CanProfilePower,null));this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this,WebInspector.Target.Capabilities.CanInspectWorkers,this._loadedWithCapabilities.bind(this,callback)));}
  1422. WebInspector.Target.Capabilities={CanScreencast:"CanScreencast",HasTouchInputs:"HasTouchInputs",CanProfilePower:"CanProfilePower",CanInspectWorkers:"CanInspectWorkers",CanEmulate:"CanEmulate"}
  1423. WebInspector.Target._nextId=1;WebInspector.Target.prototype={suspend:function()
  1424. {this.debuggerModel.suspendModel();this.cssModel.suspendModel();this.domModel.suspendModel();},resume:function()
  1425. {this.domModel.resumeModel();this.cssModel.resumeModel();this.debuggerModel.resumeModel();},id:function()
  1426. {return this._id;},name:function()
  1427. {return this._name;},_initializeCapability:function(name,callback,error,result)
  1428. {this._capabilities[name]=result;if(callback)
  1429. callback();},hasCapability:function(capability)
  1430. {return!!this._capabilities[capability];},_loadedWithCapabilities:function(callback)
  1431. {if(this._connection.isClosed()){callback(null);return;}
  1432. this.consoleModel=new WebInspector.ConsoleModel(this);this.networkManager=new WebInspector.NetworkManager(this);this.resourceTreeModel=new WebInspector.ResourceTreeModel(this);if(!WebInspector.resourceTreeModel)
  1433. WebInspector.resourceTreeModel=this.resourceTreeModel;this.networkLog=new WebInspector.NetworkLog(this);if(!WebInspector.networkLog)
  1434. WebInspector.networkLog=this.networkLog;this.debuggerModel=new WebInspector.DebuggerModel(this);if(!WebInspector.debuggerModel)
  1435. WebInspector.debuggerModel=this.debuggerModel;this.runtimeModel=new WebInspector.RuntimeModel(this);if(!WebInspector.runtimeModel)
  1436. WebInspector.runtimeModel=this.runtimeModel;this.domModel=new WebInspector.DOMModel(this);this.cssModel=new WebInspector.CSSStyleModel(this);if(!WebInspector.cssModel)
  1437. WebInspector.cssModel=this.cssModel;this.workerManager=new WebInspector.WorkerManager(this,this.hasCapability(WebInspector.Target.Capabilities.CanInspectWorkers));if(!WebInspector.workerManager)
  1438. WebInspector.workerManager=this.workerManager;if(this.hasCapability(WebInspector.Target.Capabilities.CanProfilePower))
  1439. WebInspector.powerProfiler=new WebInspector.PowerProfiler(this);this.databaseModel=new WebInspector.DatabaseModel(this);if(!WebInspector.databaseModel)
  1440. WebInspector.databaseModel=this.databaseModel;this.domStorageModel=new WebInspector.DOMStorageModel(this);if(!WebInspector.domStorageModel)
  1441. WebInspector.domStorageModel=this.domStorageModel;this.cpuProfilerModel=new WebInspector.CPUProfilerModel(this);if(!WebInspector.cpuProfilerModel)
  1442. WebInspector.cpuProfilerModel=this.cpuProfilerModel;this.heapProfilerModel=new WebInspector.HeapProfilerModel(this);this.indexedDBModel=new WebInspector.IndexedDBModel(this);this.layerTreeModel=new WebInspector.LayerTreeModel(this);this.animationModel=new WebInspector.AnimationModel(this);if(WebInspector.isWorkerFrontend()&&this.isWorkerTarget()){this.serviceWorkerCacheModel=new WebInspector.ServiceWorkerCacheModel(this);}
  1443. if(callback)
  1444. callback(this);},registerDispatcher:function(domain,dispatcher)
  1445. {this._connection.registerDispatcher(domain,dispatcher);},isWorkerTarget:function()
  1446. {return!this.hasCapability(WebInspector.Target.Capabilities.CanInspectWorkers);},canEmulate:function()
  1447. {return this.hasCapability(WebInspector.Target.Capabilities.CanEmulate);},_onDisconnect:function()
  1448. {WebInspector.targetManager.removeTarget(this);this._dispose();},_dispose:function()
  1449. {this.debuggerModel.dispose();this.networkManager.dispose();this.cpuProfilerModel.dispose();if(this.serviceWorkerCacheModel)
  1450. this.serviceWorkerCacheModel.dispose();},isDetached:function()
  1451. {return this._connection.isClosed();},__proto__:Protocol.Agents.prototype}
  1452. WebInspector.SDKObject=function(target)
  1453. {WebInspector.Object.call(this);this._target=target;}
  1454. WebInspector.SDKObject.prototype={target:function()
  1455. {return this._target;},__proto__:WebInspector.Object.prototype}
  1456. WebInspector.SDKModel=function(modelClass,target)
  1457. {WebInspector.SDKObject.call(this,target);target._modelByConstructor.set(modelClass,this);}
  1458. WebInspector.SDKModel.prototype={__proto__:WebInspector.SDKObject.prototype}
  1459. WebInspector.TargetManager=function()
  1460. {WebInspector.Object.call(this);this._targets=[];this._observers=[];this._modelListeners={};this._allTargetsSuspended=false;}
  1461. WebInspector.TargetManager.Events={InspectedURLChanged:"InspectedURLChanged",MainFrameNavigated:"MainFrameNavigated",Load:"Load",WillReloadPage:"WillReloadPage",SuspendStateChanged:"SuspendStateChanged"}
  1462. WebInspector.TargetManager.prototype={suspendAllTargets:function()
  1463. {console.assert(!this._allTargetsSuspended);if(this._allTargetsSuspended)
  1464. return;this._allTargetsSuspended=true;this._targets.forEach(function(target)
  1465. {target.suspend();});this.dispatchEventToListeners(WebInspector.TargetManager.Events.SuspendStateChanged);},resumeAllTargets:function()
  1466. {console.assert(this._allTargetsSuspended);if(!this._allTargetsSuspended)
  1467. return;this._allTargetsSuspended=false;this._targets.forEach(function(target)
  1468. {target.resume();});this.dispatchEventToListeners(WebInspector.TargetManager.Events.SuspendStateChanged);},allTargetsSuspended:function()
  1469. {return this._allTargetsSuspended;},inspectedPageURL:function()
  1470. {if(!this._targets.length)
  1471. return"";return this._targets[0].resourceTreeModel.inspectedPageURL();},inspectedPageDomain:function()
  1472. {if(!this._targets.length)
  1473. return"";return this._targets[0].resourceTreeModel.inspectedPageDomain();},_redispatchEvent:function(event)
  1474. {this.dispatchEventToListeners(event.type,event.data);},reloadPage:function(ignoreCache)
  1475. {if(this._targets.length)
  1476. this._targets[0].resourceTreeModel.reloadPage(ignoreCache);},addModelListener:function(modelClass,eventType,listener,thisObject)
  1477. {for(var i=0;i<this._targets.length;++i){var model=this._targets[i]._modelByConstructor.get(modelClass);if(model)
  1478. model.addEventListener(eventType,listener,thisObject);}
  1479. if(!this._modelListeners[eventType])
  1480. this._modelListeners[eventType]=[];this._modelListeners[eventType].push({modelClass:modelClass,thisObject:thisObject,listener:listener});},removeModelListener:function(modelClass,eventType,listener,thisObject)
  1481. {if(!this._modelListeners[eventType])
  1482. return;for(var i=0;i<this._targets.length;++i){var model=this._targets[i]._modelByConstructor.get(modelClass);if(model)
  1483. model.removeEventListener(eventType,listener,thisObject);}
  1484. var listeners=this._modelListeners[eventType];for(var i=0;i<listeners.length;++i){if(listeners[i].modelClass===modelClass&&listeners[i].listener===listener&&listeners[i].thisObject===thisObject)
  1485. listeners.splice(i--,1);}
  1486. if(!listeners.length)
  1487. delete this._modelListeners[eventType];},observeTargets:function(targetObserver)
  1488. {this.targets().forEach(targetObserver.targetAdded.bind(targetObserver));this._observers.push(targetObserver);},unobserveTargets:function(targetObserver)
  1489. {this._observers.remove(targetObserver);},createTarget:function(name,connection,callback)
  1490. {new WebInspector.Target(name,connection,callbackWrapper.bind(this));function callbackWrapper(newTarget)
  1491. {if(newTarget)
  1492. this.addTarget(newTarget);if(callback)
  1493. callback(newTarget);}},addTarget:function(target)
  1494. {this._targets.push(target);if(this._targets.length===1){target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._redispatchEvent,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._redispatchEvent,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._redispatchEvent,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.WillReloadPage,this._redispatchEvent,this);}
  1495. var copy=this._observers.slice();for(var i=0;i<copy.length;++i)
  1496. copy[i].targetAdded(target);for(var eventType in this._modelListeners){var listeners=this._modelListeners[eventType];for(var i=0;i<listeners.length;++i){var model=target._modelByConstructor.get(listeners[i].modelClass);if(model)
  1497. model.addEventListener(eventType,listeners[i].listener,listeners[i].thisObject);}}},removeTarget:function(target)
  1498. {this._targets.remove(target);if(this._targets.length===0){target.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._redispatchEvent,this);target.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._redispatchEvent,this);target.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._redispatchEvent,this);target.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.EventTypes.WillReloadPage,this._redispatchEvent,this);}
  1499. var copy=this._observers.slice();for(var i=0;i<copy.length;++i)
  1500. copy[i].targetRemoved(target);for(var eventType in this._modelListeners){var listeners=this._modelListeners[eventType];for(var i=0;i<listeners.length;++i){var model=target._modelByConstructor.get(listeners[i].modelClass);if(model)
  1501. model.removeEventListener(eventType,listeners[i].listener,listeners[i].thisObject);}}},hasTargets:function()
  1502. {return!!this._targets.length;},targets:function()
  1503. {return this._targets.slice();},mainTarget:function()
  1504. {return this._targets[0]||null;},__proto__:WebInspector.Object.prototype}
  1505. WebInspector.TargetManager.Observer=function()
  1506. {}
  1507. WebInspector.TargetManager.Observer.prototype={targetAdded:function(target){},targetRemoved:function(target){},}
  1508. WebInspector.targetManager=new WebInspector.TargetManager();;WebInspector.AnimationModel=function(target)
  1509. {WebInspector.SDKModel.call(this,WebInspector.AnimationModel,target);this._agent=target.animationAgent();target.registerAnimationDispatcher(new WebInspector.AnimationDispatcher(this));}
  1510. WebInspector.AnimationModel.Events={AnimationPlayerCreated:"AnimationPlayerCreated"}
  1511. WebInspector.AnimationModel.prototype={getAnimationPlayers:function(nodeId,showSubtreeAnimations,userCallback)
  1512. {function resultCallback(error,payloads)
  1513. {if(error){userCallback(null);return;}
  1514. userCallback(payloads.map(WebInspector.AnimationModel.AnimationPlayer.parsePayload.bind(null,this.target())));}
  1515. this._agent.getAnimationPlayersForNode(nodeId,showSubtreeAnimations,resultCallback.bind(this));},startListening:function(nodeId,showSubtreeAnimations)
  1516. {if(!this._enabled)
  1517. this._agent.enable(this._wasEnabled.bind(this));this._agent.startListening(nodeId,showSubtreeAnimations);},stopListening:function()
  1518. {this._agent.stopListening();},_wasEnabled:function()
  1519. {this._enabled=true;},animationPlayerCreated:function(payload)
  1520. {var player=WebInspector.AnimationModel.AnimationPlayer.parsePayload(this.target(),payload);this.dispatchEventToListeners(WebInspector.AnimationModel.Events.AnimationPlayerCreated,player);},__proto__:WebInspector.SDKModel.prototype}
  1521. WebInspector.AnimationModel.AnimationPlayer=function(target,payload)
  1522. {WebInspector.SDKObject.call(this,target);this._payload=payload;this._source=new WebInspector.AnimationModel.AnimationNode(this.target(),this._payload.source);}
  1523. WebInspector.AnimationModel.AnimationPlayer.parsePayload=function(target,payload)
  1524. {return new WebInspector.AnimationModel.AnimationPlayer(target,payload);}
  1525. WebInspector.AnimationModel.AnimationPlayer.prototype={payload:function()
  1526. {return this._payload;},id:function()
  1527. {return this._payload.id;},name:function()
  1528. {return this.source().name()||this.id();},paused:function()
  1529. {return this._payload.pausedState;},playState:function()
  1530. {return this._payload.playState;},playbackRate:function()
  1531. {return this._payload.playbackRate;},startTime:function()
  1532. {return this._payload.startTime;},currentTime:function()
  1533. {return this._payload.currentTime;},source:function()
  1534. {return this._source;},pause:function(callback)
  1535. {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"AnimationAgent.pauseAnimationPlayer(): ",WebInspector.AnimationModel.AnimationPlayer.bind(null,this._target));this.target().animationModel._agent.pauseAnimationPlayer(this.id(),wrappedCallback);},play:function(callback)
  1536. {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"AnimationAgent.playAnimationPlayer(): ",WebInspector.AnimationModel.AnimationPlayer.bind(null,this._target));this.target().animationModel._agent.playAnimationPlayer(this.id(),wrappedCallback);},setCurrentTime:function(currentTime,callback)
  1537. {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"AnimationAgent.setAnimationPlayerCurrentTime(): ",WebInspector.AnimationModel.AnimationPlayer.bind(null,this._target));this.target().animationModel._agent.setAnimationPlayerCurrentTime(this.id(),currentTime,wrappedCallback);},getCurrentState:function(callback)
  1538. {function mycallback(error,currentTime,isRunning)
  1539. {if(error)
  1540. return;callback(currentTime,isRunning);}
  1541. this.target().animationModel._agent.getAnimationPlayerState(this.id(),mycallback);},__proto__:WebInspector.SDKObject.prototype}
  1542. WebInspector.AnimationModel.AnimationNode=function(target,payload)
  1543. {WebInspector.SDKObject.call(this,target);this._payload=payload;if(payload.keyframesRule)
  1544. this._keyframesRule=new WebInspector.AnimationModel.KeyframesRule(target,payload.keyframesRule);}
  1545. WebInspector.AnimationModel.AnimationNode.prototype={startDelay:function()
  1546. {return this._payload.startDelay;},playbackRate:function()
  1547. {return this._payload.playbackRate;},iterationStart:function()
  1548. {return this._payload.iterationStart;},iterationCount:function()
  1549. {return this._payload.iterationCount;},duration:function()
  1550. {return this._payload.duration;},direction:function()
  1551. {return this._payload.direction;},fillMode:function()
  1552. {return this._payload.fillMode;},timeFraction:function()
  1553. {return this._payload.timeFraction;},name:function()
  1554. {return this._payload.name;},getNode:function(callback)
  1555. {function nodePushedCallback(nodeIds)
  1556. {if(nodeIds)
  1557. this.nodeId=nodeIds[0];callback(this.target().domModel.nodeForId(this.nodeId));}
  1558. if(this.nodeId)
  1559. callback(this.target().domModel.nodeForId(this.nodeId));else
  1560. this._target.domModel.pushNodesByBackendIdsToFrontend([this._payload.backendNodeId],nodePushedCallback.bind(this));},keyframesRule:function()
  1561. {return this._keyframesRule;},__proto__:WebInspector.SDKObject.prototype}
  1562. WebInspector.AnimationModel.KeyframesRule=function(target,payload)
  1563. {WebInspector.SDKObject.call(this,target);this._payload=payload;this._keyframes=this._payload.keyframes.map(function(keyframeStyle){return new WebInspector.AnimationModel.KeyframeStyle(target,keyframeStyle);});}
  1564. WebInspector.AnimationModel.KeyframesRule.prototype={_setKeyframesPayload:function(payload)
  1565. {this._keyframes=payload.map(function(keyframeStyle){return new WebInspector.AnimationModel.KeyframeStyle(this._target,keyframeStyle);});},name:function()
  1566. {return this._payload.name;},keyframes:function()
  1567. {return this._keyframes;},__proto__:WebInspector.SDKObject.prototype}
  1568. WebInspector.AnimationModel.KeyframeStyle=function(target,payload)
  1569. {WebInspector.SDKObject.call(this,target);this._payload=payload;this._style=WebInspector.CSSStyleDeclaration.parsePayload(this.target().cssModel,payload.style);}
  1570. WebInspector.AnimationModel.KeyframeStyle.prototype={offset:function()
  1571. {return this._payload.offset;},style:function()
  1572. {return this._style;},__proto__:WebInspector.SDKObject.prototype}
  1573. WebInspector.AnimationDispatcher=function(animationModel)
  1574. {this._animationModel=animationModel;}
  1575. WebInspector.AnimationDispatcher.prototype={animationPlayerCreated:function(payload)
  1576. {this._animationModel.animationPlayerCreated(payload);}};WebInspector.ApplicationCacheModel=function(target)
  1577. {WebInspector.SDKObject.call(this,target);target.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheDispatcher(this));this._agent=target.applicationCacheAgent();this._agent.enable();target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,this._frameNavigated,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this._frameDetached,this);this._statuses={};this._manifestURLsByFrame={};this._mainFrameNavigated();this._onLine=true;}
  1578. WebInspector.ApplicationCacheModel.EventTypes={FrameManifestStatusUpdated:"FrameManifestStatusUpdated",FrameManifestAdded:"FrameManifestAdded",FrameManifestRemoved:"FrameManifestRemoved",NetworkStateChanged:"NetworkStateChanged"}
  1579. WebInspector.ApplicationCacheModel.prototype={_frameNavigated:function(event)
  1580. {var frame=(event.data);if(frame.isMainFrame()){this._mainFrameNavigated();return;}
  1581. this._agent.getManifestForFrame(frame.id,this._manifestForFrameLoaded.bind(this,frame.id));},_frameDetached:function(event)
  1582. {var frame=(event.data);this._frameManifestRemoved(frame.id);},_mainFrameNavigated:function()
  1583. {this._agent.getFramesWithManifests(this._framesWithManifestsLoaded.bind(this));},_manifestForFrameLoaded:function(frameId,error,manifestURL)
  1584. {if(error){console.error(error);return;}
  1585. if(!manifestURL)
  1586. this._frameManifestRemoved(frameId);},_framesWithManifestsLoaded:function(error,framesWithManifests)
  1587. {if(error){console.error(error);return;}
  1588. for(var i=0;i<framesWithManifests.length;++i)
  1589. this._frameManifestUpdated(framesWithManifests[i].frameId,framesWithManifests[i].manifestURL,framesWithManifests[i].status);},_frameManifestUpdated:function(frameId,manifestURL,status)
  1590. {if(status===applicationCache.UNCACHED){this._frameManifestRemoved(frameId);return;}
  1591. if(!manifestURL)
  1592. return;if(this._manifestURLsByFrame[frameId]&&manifestURL!==this._manifestURLsByFrame[frameId])
  1593. this._frameManifestRemoved(frameId);var statusChanged=this._statuses[frameId]!==status;this._statuses[frameId]=status;if(!this._manifestURLsByFrame[frameId]){this._manifestURLsByFrame[frameId]=manifestURL;this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestAdded,frameId);}
  1594. if(statusChanged)
  1595. this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestStatusUpdated,frameId);},_frameManifestRemoved:function(frameId)
  1596. {if(!this._manifestURLsByFrame[frameId])
  1597. return;delete this._manifestURLsByFrame[frameId];delete this._statuses[frameId];this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestRemoved,frameId);},frameManifestURL:function(frameId)
  1598. {return this._manifestURLsByFrame[frameId]||"";},frameManifestStatus:function(frameId)
  1599. {return this._statuses[frameId]||applicationCache.UNCACHED;},get onLine()
  1600. {return this._onLine;},_statusUpdated:function(frameId,manifestURL,status)
  1601. {this._frameManifestUpdated(frameId,manifestURL,status);},requestApplicationCache:function(frameId,callback)
  1602. {function callbackWrapper(error,applicationCache)
  1603. {if(error){console.error(error);callback(null);return;}
  1604. callback(applicationCache);}
  1605. this._agent.getApplicationCacheForFrame(frameId,callbackWrapper);},_networkStateUpdated:function(isNowOnline)
  1606. {this._onLine=isNowOnline;this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged,isNowOnline);},__proto__:WebInspector.SDKObject.prototype}
  1607. WebInspector.ApplicationCacheDispatcher=function(applicationCacheModel)
  1608. {this._applicationCacheModel=applicationCacheModel;}
  1609. WebInspector.ApplicationCacheDispatcher.prototype={applicationCacheStatusUpdated:function(frameId,manifestURL,status)
  1610. {this._applicationCacheModel._statusUpdated(frameId,manifestURL,status);},networkStateUpdated:function(isNowOnline)
  1611. {this._applicationCacheModel._networkStateUpdated(isNowOnline);}};WebInspector.BlackboxSupport={}
  1612. WebInspector.BlackboxSupport._urlToRegExpString=function(url)
  1613. {var parsedURL=new WebInspector.ParsedURL(url);if(parsedURL.isAboutBlank()||parsedURL.isDataURL()||!url)
  1614. return"";if(!parsedURL.isValid)
  1615. return"^"+url.escapeForRegExp()+"$";var name=parsedURL.lastPathComponent;if(name)
  1616. name="/"+name;else if(parsedURL.folderPathComponents)
  1617. name=parsedURL.folderPathComponents+"/";if(!name)
  1618. name=parsedURL.host;if(!name)
  1619. return"";var scheme=parsedURL.scheme;var prefix="";if(scheme&&scheme!=="http"&&scheme!=="https"){prefix="^"+scheme+"://";if(scheme==="chrome-extension")
  1620. prefix+=parsedURL.host+"\\b";prefix+=".*";}
  1621. return prefix+name.escapeForRegExp()+(url.endsWith(name)?"$":"\\b");}
  1622. WebInspector.BlackboxSupport.canBlackboxURL=function(url)
  1623. {return!!WebInspector.BlackboxSupport._urlToRegExpString(url);}
  1624. WebInspector.BlackboxSupport.blackboxURL=function(url)
  1625. {var regexPatterns=WebInspector.settings.skipStackFramesPattern.getAsArray();var regexValue=WebInspector.BlackboxSupport._urlToRegExpString(url);if(!regexValue)
  1626. return;var found=false;for(var i=0;i<regexPatterns.length;++i){var item=regexPatterns[i];if(item.pattern===regexValue){item.disabled=false;found=true;break;}}
  1627. if(!found)
  1628. regexPatterns.push({pattern:regexValue});WebInspector.settings.skipStackFramesPattern.setAsArray(regexPatterns);}
  1629. WebInspector.BlackboxSupport.unblackbox=function(url,isContentScript)
  1630. {if(isContentScript)
  1631. WebInspector.settings.skipContentScripts.set(false);var regexPatterns=WebInspector.settings.skipStackFramesPattern.getAsArray();var regexValue=WebInspector.BlackboxSupport._urlToRegExpString(url);if(!regexValue)
  1632. return;regexPatterns=regexPatterns.filter(function(item){return item.pattern!==regexValue;});for(var i=0;i<regexPatterns.length;++i){var item=regexPatterns[i];if(item.disabled)
  1633. continue;try{var regex=new RegExp(item.pattern);if(regex.test(url))
  1634. item.disabled=true;}catch(e){}}
  1635. WebInspector.settings.skipStackFramesPattern.setAsArray(regexPatterns);}
  1636. WebInspector.BlackboxSupport.isBlackboxedURL=function(url)
  1637. {var regex=WebInspector.settings.skipStackFramesPattern.asRegExp();return(url&®ex)?regex.test(url):false;}
  1638. WebInspector.BlackboxSupport.isBlackboxed=function(url,isContentScript)
  1639. {if(isContentScript&&WebInspector.settings.skipContentScripts.get())
  1640. return true;return WebInspector.BlackboxSupport.isBlackboxedURL(url);};WebInspector.ConsoleModel=function(target)
  1641. {WebInspector.SDKModel.call(this,WebInspector.ConsoleModel,target);this._messages=[];this.warnings=0;this.errors=0;this._consoleAgent=target.consoleAgent();target.registerConsoleDispatcher(new WebInspector.ConsoleDispatcher(this));this._enableAgent();}
  1642. WebInspector.ConsoleModel.Events={ConsoleCleared:"ConsoleCleared",MessageAdded:"MessageAdded",CommandEvaluated:"CommandEvaluated",}
  1643. WebInspector.ConsoleModel.prototype={_enableAgent:function()
  1644. {if(WebInspector.settings.monitoringXHREnabled.get())
  1645. this._consoleAgent.setMonitoringXHREnabled(true);this._enablingConsole=true;function callback()
  1646. {delete this._enablingConsole;}
  1647. this._consoleAgent.enable(callback.bind(this));},enablingConsole:function()
  1648. {return!!this._enablingConsole;},addMessage:function(msg)
  1649. {if(WebInspector.NetworkManager.hasDevToolsRequestHeader(msg.request))
  1650. return;msg.index=this._messages.length;this._messages.push(msg);this._incrementErrorWarningCount(msg);this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageAdded,msg);},_incrementErrorWarningCount:function(msg)
  1651. {switch(msg.level){case WebInspector.ConsoleMessage.MessageLevel.Warning:this.warnings++;break;case WebInspector.ConsoleMessage.MessageLevel.Error:this.errors++;break;}},messages:function()
  1652. {return this._messages;},requestClearMessages:function()
  1653. {this._consoleAgent.clearMessages();this._messagesCleared();},_messagesCleared:function()
  1654. {this._messages=[];this.errors=0;this.warnings=0;this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.ConsoleCleared);},__proto__:WebInspector.SDKModel.prototype}
  1655. WebInspector.ConsoleModel.evaluateCommandInConsole=function(executionContext,text,useCommandLineAPI)
  1656. {useCommandLineAPI=!!useCommandLineAPI;var target=executionContext.target();var commandMessage=new WebInspector.ConsoleMessage(target,WebInspector.ConsoleMessage.MessageSource.JS,null,text,WebInspector.ConsoleMessage.MessageType.Command);commandMessage.setExecutionContextId(executionContext.id);target.consoleModel.addMessage(commandMessage);function printResult(result,wasThrown,valueResult,exceptionDetails)
  1657. {if(!result)
  1658. return;WebInspector.console.showPromise().then(reportUponEvaluation);function reportUponEvaluation()
  1659. {target.consoleModel.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated,{result:result,wasThrown:wasThrown,text:text,commandMessage:commandMessage,exceptionDetails:exceptionDetails});}}
  1660. executionContext.evaluate(text,"console",useCommandLineAPI,false,false,true,printResult);WebInspector.userMetrics.ConsoleEvaluated.record();}
  1661. WebInspector.ConsoleMessage=function(target,source,level,messageText,type,url,line,column,requestId,parameters,stackTrace,timestamp,isOutdated,executionContextId,asyncStackTrace,scriptId)
  1662. {this._target=target;this.source=source;this.level=level;this.messageText=messageText;this.type=type||WebInspector.ConsoleMessage.MessageType.Log;this.url=url||undefined;this.line=line||0;this.column=column||0;this.parameters=parameters;this.stackTrace=stackTrace;this.timestamp=timestamp||Date.now();this.isOutdated=isOutdated;this.executionContextId=executionContextId||0;this.asyncStackTrace=asyncStackTrace;this.scriptId=scriptId||null;this.request=requestId?target.networkLog.requestForId(requestId):null;if(this.request){var initiator=this.request.initiator();if(initiator){this.stackTrace=initiator.stackTrace||undefined;this.asyncStackTrace=initiator.asyncStackTrace;if(initiator.url){this.url=initiator.url;this.line=initiator.lineNumber||0;}}}}
  1663. WebInspector.ConsoleMessage.prototype={target:function()
  1664. {return this._target;},setOriginatingMessage:function(originatingMessage)
  1665. {this._originatingConsoleMessage=originatingMessage;this.executionContextId=originatingMessage.executionContextId;},setExecutionContextId:function(executionContextId)
  1666. {this.executionContextId=executionContextId;},originatingMessage:function()
  1667. {return this._originatingConsoleMessage;},isGroupMessage:function()
  1668. {return this.type===WebInspector.ConsoleMessage.MessageType.StartGroup||this.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed||this.type===WebInspector.ConsoleMessage.MessageType.EndGroup;},isGroupStartMessage:function()
  1669. {return this.type===WebInspector.ConsoleMessage.MessageType.StartGroup||this.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed;},isErrorOrWarning:function()
  1670. {return(this.level===WebInspector.ConsoleMessage.MessageLevel.Warning||this.level===WebInspector.ConsoleMessage.MessageLevel.Error);},clone:function()
  1671. {return new WebInspector.ConsoleMessage(this.target(),this.source,this.level,this.messageText,this.type,this.url,this.line,this.column,this.request?this.request.requestId:undefined,this.parameters,this.stackTrace,this.timestamp,this.isOutdated,this.executionContextId,this.asyncStackTrace,this.scriptId);},isEqual:function(msg)
  1672. {if(!msg)
  1673. return false;if(!this._isEqualStackTraces(this.stackTrace,msg.stackTrace))
  1674. return false;var asyncTrace1=this.asyncStackTrace;var asyncTrace2=msg.asyncStackTrace;while(asyncTrace1||asyncTrace2){if(!asyncTrace1||!asyncTrace2)
  1675. return false;if(asyncTrace1.description!==asyncTrace2.description)
  1676. return false;if(!this._isEqualStackTraces(asyncTrace1.callFrames,asyncTrace2.callFrames))
  1677. return false;asyncTrace1=asyncTrace1.asyncStackTrace;asyncTrace2=asyncTrace2.asyncStackTrace;}
  1678. if(this.parameters){if(!msg.parameters||this.parameters.length!==msg.parameters.length)
  1679. return false;for(var i=0;i<msg.parameters.length;++i){if(this.parameters[i].type!==msg.parameters[i].type||msg.parameters[i].type==="object"||this.parameters[i].value!==msg.parameters[i].value)
  1680. return false;}}
  1681. return(this.target()===msg.target())&&(this.source===msg.source)&&(this.type===msg.type)&&(this.level===msg.level)&&(this.line===msg.line)&&(this.url===msg.url)&&(this.messageText===msg.messageText)&&(this.request===msg.request)&&(this.executionContextId===msg.executionContextId)&&(this.scriptId===msg.scriptId);},_isEqualStackTraces:function(stackTrace1,stackTrace2)
  1682. {stackTrace1=stackTrace1||[];stackTrace2=stackTrace2||[];if(stackTrace1.length!==stackTrace2.length)
  1683. return false;for(var i=0,n=stackTrace1.length;i<n;++i){if(stackTrace1[i].url!==stackTrace2[i].url||stackTrace1[i].functionName!==stackTrace2[i].functionName||stackTrace1[i].lineNumber!==stackTrace2[i].lineNumber||stackTrace1[i].columnNumber!==stackTrace2[i].columnNumber)
  1684. return false;}
  1685. return true;}}
  1686. WebInspector.ConsoleMessage.MessageSource={XML:"xml",JS:"javascript",Network:"network",ConsoleAPI:"console-api",Storage:"storage",AppCache:"appcache",Rendering:"rendering",CSS:"css",Security:"security",Other:"other",Deprecation:"deprecation"}
  1687. WebInspector.ConsoleMessage.MessageType={Log:"log",Dir:"dir",DirXML:"dirxml",Table:"table",Trace:"trace",Clear:"clear",StartGroup:"startGroup",StartGroupCollapsed:"startGroupCollapsed",EndGroup:"endGroup",Assert:"assert",Result:"result",Profile:"profile",ProfileEnd:"profileEnd",Command:"command"}
  1688. WebInspector.ConsoleMessage.MessageLevel={Log:"log",Info:"info",Warning:"warning",Error:"error",Debug:"debug"};WebInspector.ConsoleMessage.timestampComparator=function(a,b)
  1689. {return a.timestamp-b.timestamp;}
  1690. WebInspector.ConsoleDispatcher=function(console)
  1691. {this._console=console;}
  1692. WebInspector.ConsoleDispatcher.prototype={messageAdded:function(payload)
  1693. {var consoleMessage=new WebInspector.ConsoleMessage(this._console.target(),payload.source,payload.level,payload.text,payload.type,payload.url,payload.line,payload.column,payload.networkRequestId,payload.parameters,payload.stackTrace,payload.timestamp*1000,this._console._enablingConsole,payload.executionContextId,payload.asyncStackTrace,payload.scriptId);this._console.addMessage(consoleMessage);},messageRepeatCountUpdated:function(count)
  1694. {},messagesCleared:function()
  1695. {if(!WebInspector.settings.preserveConsoleLog.get())
  1696. this._console._messagesCleared();}}
  1697. WebInspector.MultitargetConsoleModel=function()
  1698. {WebInspector.targetManager.observeTargets(this);WebInspector.targetManager.addModelListener(WebInspector.ConsoleModel,WebInspector.ConsoleModel.Events.MessageAdded,this._consoleMessageAdded,this);WebInspector.targetManager.addModelListener(WebInspector.ConsoleModel,WebInspector.ConsoleModel.Events.CommandEvaluated,this._commandEvaluated,this);}
  1699. WebInspector.MultitargetConsoleModel.prototype={targetAdded:function(target)
  1700. {if(!this._mainTarget){this._mainTarget=target;target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);}},targetRemoved:function(target)
  1701. {if(this._mainTarget===target){delete this._mainTarget;target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);}},messages:function()
  1702. {var targets=WebInspector.targetManager.targets();var result=[];for(var i=0;i<targets.length;++i)
  1703. result=result.concat(targets[i].consoleModel.messages());return result;},_consoleCleared:function()
  1704. {this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.ConsoleCleared);},_consoleMessageAdded:function(event)
  1705. {this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageAdded,event.data);},_commandEvaluated:function(event)
  1706. {this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated,event.data);},__proto__:WebInspector.Object.prototype}
  1707. WebInspector.multitargetConsoleModel;;WebInspector.ConcatenatedScriptsContentProvider=function(scripts)
  1708. {this._scripts=scripts;}
  1709. WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag="<script>";WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag="</script>";WebInspector.ConcatenatedScriptsContentProvider.prototype={_sortedScripts:function()
  1710. {if(this._sortedScriptsArray)
  1711. return this._sortedScriptsArray;this._sortedScriptsArray=[];var scripts=this._scripts.slice();scripts.sort(function(x,y){return x.lineOffset-y.lineOffset||x.columnOffset-y.columnOffset;});var scriptOpenTagLength=WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag.length;var scriptCloseTagLength=WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag.length;this._sortedScriptsArray.push(scripts[0]);for(var i=1;i<scripts.length;++i){var previousScript=this._sortedScriptsArray[this._sortedScriptsArray.length-1];var lineNumber=previousScript.endLine;var columnNumber=previousScript.endColumn+scriptCloseTagLength+scriptOpenTagLength;if(lineNumber<scripts[i].lineOffset||(lineNumber===scripts[i].lineOffset&&columnNumber<=scripts[i].columnOffset))
  1712. this._sortedScriptsArray.push(scripts[i]);}
  1713. return this._sortedScriptsArray;},contentURL:function()
  1714. {return"";},contentType:function()
  1715. {return WebInspector.resourceTypes.Document;},requestContent:function(callback)
  1716. {var scripts=this._sortedScripts();var sources=[];function didRequestSource(content)
  1717. {sources.push(content);if(sources.length==scripts.length)
  1718. callback(this._concatenateScriptsContent(scripts,sources));}
  1719. for(var i=0;i<scripts.length;++i)
  1720. scripts[i].requestContent(didRequestSource.bind(this));},searchInContent:function(query,caseSensitive,isRegex,callback)
  1721. {var results={};var scripts=this._sortedScripts();var scriptsLeft=scripts.length;function maybeCallback()
  1722. {if(scriptsLeft)
  1723. return;var result=[];for(var i=0;i<scripts.length;++i)
  1724. result=result.concat(results[scripts[i].scriptId]);callback(result);}
  1725. function searchCallback(script,searchMatches)
  1726. {results[script.scriptId]=[];for(var i=0;i<searchMatches.length;++i){var searchMatch=new WebInspector.ContentProvider.SearchMatch(searchMatches[i].lineNumber+script.lineOffset,searchMatches[i].lineContent);results[script.scriptId].push(searchMatch);}
  1727. scriptsLeft--;maybeCallback();}
  1728. maybeCallback();for(var i=0;i<scripts.length;++i)
  1729. scripts[i].searchInContent(query,caseSensitive,isRegex,searchCallback.bind(null,scripts[i]));},_concatenateScriptsContent:function(scripts,sources)
  1730. {var content="";var lineNumber=0;var columnNumber=0;var scriptOpenTag=WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag;var scriptCloseTag=WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag;for(var i=0;i<scripts.length;++i){for(var newLinesCount=scripts[i].lineOffset-lineNumber;newLinesCount>0;--newLinesCount){columnNumber=0;content+="\n";}
  1731. for(var spacesCount=scripts[i].columnOffset-columnNumber-scriptOpenTag.length;spacesCount>0;--spacesCount)
  1732. content+=" ";content+=scriptOpenTag;content+=sources[i];content+=scriptCloseTag;lineNumber=scripts[i].endLine;columnNumber=scripts[i].endColumn+scriptCloseTag.length;}
  1733. return content;}}
  1734. WebInspector.CompilerSourceMappingContentProvider=function(sourceURL,contentType)
  1735. {this._sourceURL=sourceURL;this._contentType=contentType;}
  1736. WebInspector.CompilerSourceMappingContentProvider.prototype={contentURL:function()
  1737. {return this._sourceURL;},contentType:function()
  1738. {return this._contentType;},requestContent:function(callback)
  1739. {NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,this._sourceURL,undefined,contentLoaded.bind(this));function contentLoaded(error,statusCode,headers,content)
  1740. {if(error||statusCode>=400){console.error("Could not load content for "+this._sourceURL+" : "+(error||("HTTP status code: "+statusCode)));callback(null);return;}
  1741. callback(content);}},searchInContent:function(query,caseSensitive,isRegex,callback)
  1742. {this.requestContent(contentLoaded);function contentLoaded(content)
  1743. {if(typeof content!=="string"){callback([]);return;}
  1744. callback(WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex));}}};WebInspector.CookieParser=function()
  1745. {}
  1746. WebInspector.CookieParser.KeyValue=function(key,value,position)
  1747. {this.key=key;this.value=value;this.position=position;}
  1748. WebInspector.CookieParser.prototype={cookies:function()
  1749. {return this._cookies;},parseCookie:function(cookieHeader)
  1750. {if(!this._initialize(cookieHeader))
  1751. return null;for(var kv=this._extractKeyValue();kv;kv=this._extractKeyValue()){if(kv.key.charAt(0)==="$"&&this._lastCookie)
  1752. this._lastCookie.addAttribute(kv.key.slice(1),kv.value);else if(kv.key.toLowerCase()!=="$version"&&typeof kv.value==="string")
  1753. this._addCookie(kv,WebInspector.Cookie.Type.Request);this._advanceAndCheckCookieDelimiter();}
  1754. this._flushCookie();return this._cookies;},parseSetCookie:function(setCookieHeader)
  1755. {if(!this._initialize(setCookieHeader))
  1756. return null;for(var kv=this._extractKeyValue();kv;kv=this._extractKeyValue()){if(this._lastCookie)
  1757. this._lastCookie.addAttribute(kv.key,kv.value);else
  1758. this._addCookie(kv,WebInspector.Cookie.Type.Response);if(this._advanceAndCheckCookieDelimiter())
  1759. this._flushCookie();}
  1760. this._flushCookie();return this._cookies;},_initialize:function(headerValue)
  1761. {this._input=headerValue;if(typeof headerValue!=="string")
  1762. return false;this._cookies=[];this._lastCookie=null;this._originalInputLength=this._input.length;return true;},_flushCookie:function()
  1763. {if(this._lastCookie)
  1764. this._lastCookie.setSize(this._originalInputLength-this._input.length-this._lastCookiePosition);this._lastCookie=null;},_extractKeyValue:function()
  1765. {if(!this._input||!this._input.length)
  1766. return null;var keyValueMatch=/^[ \t]*([^\s=;]+)[ \t]*(?:=[ \t]*([^;\n]*))?/.exec(this._input);if(!keyValueMatch){console.log("Failed parsing cookie header before: "+this._input);return null;}
  1767. var result=new WebInspector.CookieParser.KeyValue(keyValueMatch[1],keyValueMatch[2]&&keyValueMatch[2].trim(),this._originalInputLength-this._input.length);this._input=this._input.slice(keyValueMatch[0].length);return result;},_advanceAndCheckCookieDelimiter:function()
  1768. {var match=/^\s*[\n;]\s*/.exec(this._input);if(!match)
  1769. return false;this._input=this._input.slice(match[0].length);return match[0].match("\n")!==null;},_addCookie:function(keyValue,type)
  1770. {if(this._lastCookie)
  1771. this._lastCookie.setSize(keyValue.position-this._lastCookiePosition);this._lastCookie=typeof keyValue.value==="string"?new WebInspector.Cookie(keyValue.key,keyValue.value,type):new WebInspector.Cookie("",keyValue.key,type);this._lastCookiePosition=keyValue.position;this._cookies.push(this._lastCookie);}};WebInspector.CookieParser.parseCookie=function(header)
  1772. {return(new WebInspector.CookieParser()).parseCookie(header);}
  1773. WebInspector.CookieParser.parseSetCookie=function(header)
  1774. {return(new WebInspector.CookieParser()).parseSetCookie(header);}
  1775. WebInspector.Cookie=function(name,value,type)
  1776. {this._name=name;this._value=value;this._type=type;this._attributes={};}
  1777. WebInspector.Cookie.prototype={name:function()
  1778. {return this._name;},value:function()
  1779. {return this._value;},type:function()
  1780. {return this._type;},httpOnly:function()
  1781. {return"httponly"in this._attributes;},secure:function()
  1782. {return"secure"in this._attributes;},session:function()
  1783. {return!("expires"in this._attributes||"max-age"in this._attributes);},path:function()
  1784. {return this._attributes["path"];},port:function()
  1785. {return this._attributes["port"];},domain:function()
  1786. {return this._attributes["domain"];},expires:function()
  1787. {return this._attributes["expires"];},maxAge:function()
  1788. {return this._attributes["max-age"];},size:function()
  1789. {return this._size;},setSize:function(size)
  1790. {this._size=size;},expiresDate:function(requestDate)
  1791. {if(this.maxAge()){var targetDate=requestDate===null?new Date():requestDate;return new Date(targetDate.getTime()+1000*this.maxAge());}
  1792. if(this.expires())
  1793. return new Date(this.expires());return null;},attributes:function()
  1794. {return this._attributes;},addAttribute:function(key,value)
  1795. {this._attributes[key.toLowerCase()]=value;},remove:function(callback)
  1796. {PageAgent.deleteCookie(this.name(),(this.secure()?"https://":"http://")+this.domain()+this.path(),callback);}}
  1797. WebInspector.Cookie.Type={Request:0,Response:1};WebInspector.Cookies={}
  1798. WebInspector.Cookies.getCookiesAsync=function(callback)
  1799. {function mycallback(error,cookies)
  1800. {if(error)
  1801. return;callback(cookies.map(WebInspector.Cookies.buildCookieProtocolObject));}
  1802. PageAgent.getCookies(mycallback);}
  1803. WebInspector.Cookies.buildCookieProtocolObject=function(protocolCookie)
  1804. {var cookie=new WebInspector.Cookie(protocolCookie.name,protocolCookie.value,null);cookie.addAttribute("domain",protocolCookie["domain"]);cookie.addAttribute("path",protocolCookie["path"]);cookie.addAttribute("port",protocolCookie["port"]);if(protocolCookie["expires"])
  1805. cookie.addAttribute("expires",protocolCookie["expires"]);if(protocolCookie["httpOnly"])
  1806. cookie.addAttribute("httpOnly");if(protocolCookie["secure"])
  1807. cookie.addAttribute("secure");cookie.setSize(protocolCookie["size"]);return cookie;}
  1808. WebInspector.Cookies.cookieMatchesResourceURL=function(cookie,resourceURL)
  1809. {var url=resourceURL.asParsedURL();if(!url||!WebInspector.Cookies.cookieDomainMatchesResourceDomain(cookie.domain(),url.host))
  1810. return false;return(url.path.startsWith(cookie.path())&&(!cookie.port()||url.port==cookie.port())&&(!cookie.secure()||url.scheme==="https"));}
  1811. WebInspector.Cookies.cookieDomainMatchesResourceDomain=function(cookieDomain,resourceDomain)
  1812. {if(cookieDomain.charAt(0)!=='.')
  1813. return resourceDomain===cookieDomain;return!!resourceDomain.match(new RegExp("^([^\\.]+\\.)*"+cookieDomain.substring(1).escapeForRegExp()+"$","i"));};WebInspector.CPUProfileDataModel=function(profile)
  1814. {this.profileHead=profile.head;this.samples=profile.samples;this.timestamps=profile.timestamps;this.profileStartTime=profile.startTime*1000;this.profileEndTime=profile.endTime*1000;this._assignParentsInProfile();if(this.samples){this._normalizeTimestamps();this._buildIdToNodeMap();this._fixMissingSamples();}
  1815. this._calculateTimes(profile);}
  1816. WebInspector.CPUProfileDataModel.prototype={_calculateTimes:function(profile)
  1817. {function totalHitCount(node){var result=node.hitCount;for(var i=0;i<node.children.length;i++)
  1818. result+=totalHitCount(node.children[i]);return result;}
  1819. profile.totalHitCount=totalHitCount(profile.head);var duration=this.profileEndTime-this.profileStartTime;var samplingInterval=duration/profile.totalHitCount;this.samplingInterval=samplingInterval;function calculateTimesForNode(node){node.selfTime=node.hitCount*samplingInterval;var totalHitCount=node.hitCount;for(var i=0;i<node.children.length;i++)
  1820. totalHitCount+=calculateTimesForNode(node.children[i]);node.totalTime=totalHitCount*samplingInterval;return totalHitCount;}
  1821. calculateTimesForNode(profile.head);},_assignParentsInProfile:function()
  1822. {var head=this.profileHead;head.parent=null;head.depth=-1;this.maxDepth=0;var nodesToTraverse=[head];while(nodesToTraverse.length){var parent=nodesToTraverse.pop();var depth=parent.depth+1;if(depth>this.maxDepth)
  1823. this.maxDepth=depth;var children=parent.children;var length=children.length;for(var i=0;i<length;++i){var child=children[i];child.parent=parent;child.depth=depth;if(child.children.length)
  1824. nodesToTraverse.push(child);}}},_normalizeTimestamps:function()
  1825. {var timestamps=this.timestamps;if(!timestamps){var profileStartTime=this.profileStartTime;var interval=(this.profileEndTime-profileStartTime)/this.samples.length;timestamps=new Float64Array(this.samples.length+1);for(var i=0;i<timestamps.length;++i)
  1826. timestamps[i]=profileStartTime+i*interval;this.timestamps=timestamps;return;}
  1827. for(var i=0;i<timestamps.length;++i)
  1828. timestamps[i]/=1000;var averageSample=(timestamps.peekLast()-timestamps[0])/(timestamps.length-1);this.timestamps.push(timestamps.peekLast()+averageSample);this.profileStartTime=timestamps[0];this.profileEndTime=timestamps.peekLast();},_buildIdToNodeMap:function()
  1829. {this._idToNode={};var idToNode=this._idToNode;var stack=[this.profileHead];while(stack.length){var node=stack.pop();idToNode[node.id]=node;for(var i=0;i<node.children.length;i++)
  1830. stack.push(node.children[i]);}
  1831. var topLevelNodes=this.profileHead.children;for(var i=0;i<topLevelNodes.length&&!(this.gcNode&&this.programNode&&this.idleNode);i++){var node=topLevelNodes[i];if(node.functionName==="(garbage collector)")
  1832. this.gcNode=node;else if(node.functionName==="(program)")
  1833. this.programNode=node;else if(node.functionName==="(idle)")
  1834. this.idleNode=node;}},_fixMissingSamples:function()
  1835. {var samples=this.samples;var samplesCount=samples.length;if(!this.programNode||samplesCount<3)
  1836. return;var idToNode=this._idToNode;var programNodeId=this.programNode.id;var gcNodeId=this.gcNode?this.gcNode.id:-1;var idleNodeId=this.idleNode?this.idleNode.id:-1;var prevNodeId=samples[0];var nodeId=samples[1];for(var sampleIndex=1;sampleIndex<samplesCount-1;sampleIndex++){var nextNodeId=samples[sampleIndex+1];if(nodeId===programNodeId&&!isSystemNode(prevNodeId)&&!isSystemNode(nextNodeId)&&bottomNode(idToNode[prevNodeId])===bottomNode(idToNode[nextNodeId])){samples[sampleIndex]=prevNodeId;}
  1837. prevNodeId=nodeId;nodeId=nextNodeId;}
  1838. function bottomNode(node)
  1839. {while(node.parent)
  1840. node=node.parent;return node;}
  1841. function isSystemNode(nodeId)
  1842. {return nodeId===programNodeId||nodeId===gcNodeId||nodeId===idleNodeId;}},forEachFrame:function(openFrameCallback,closeFrameCallback,startTime,stopTime)
  1843. {if(!this.profileHead)
  1844. return;startTime=startTime||0;stopTime=stopTime||Infinity;var samples=this.samples;var timestamps=this.timestamps;var idToNode=this._idToNode;var gcNode=this.gcNode;var samplesCount=samples.length;var startIndex=timestamps.lowerBound(startTime);var stackTop=0;var stackNodes=[];var prevId=this.profileHead.id;var sampleTime=timestamps[samplesCount];var gcParentNode=null;if(!this._stackStartTimes)
  1845. this._stackStartTimes=new Float64Array(this.maxDepth+2);var stackStartTimes=this._stackStartTimes;if(!this._stackChildrenDuration)
  1846. this._stackChildrenDuration=new Float64Array(this.maxDepth+2);var stackChildrenDuration=this._stackChildrenDuration;for(var sampleIndex=startIndex;sampleIndex<samplesCount;sampleIndex++){sampleTime=timestamps[sampleIndex];if(sampleTime>=stopTime)
  1847. break;var id=samples[sampleIndex];if(id===prevId)
  1848. continue;var node=idToNode[id];var prevNode=idToNode[prevId];if(node===gcNode){gcParentNode=prevNode;openFrameCallback(gcParentNode.depth+1,gcNode,sampleTime);stackStartTimes[++stackTop]=sampleTime;stackChildrenDuration[stackTop]=0;prevId=id;continue;}
  1849. if(prevNode===gcNode){var start=stackStartTimes[stackTop];var duration=sampleTime-start;stackChildrenDuration[stackTop-1]+=duration;closeFrameCallback(gcParentNode.depth+1,gcNode,start,duration,duration-stackChildrenDuration[stackTop]);--stackTop;prevNode=gcParentNode;prevId=prevNode.id;gcParentNode=null;}
  1850. while(node.depth>prevNode.depth){stackNodes.push(node);node=node.parent;}
  1851. while(prevNode!==node){var start=stackStartTimes[stackTop];var duration=sampleTime-start;stackChildrenDuration[stackTop-1]+=duration;closeFrameCallback(prevNode.depth,prevNode,start,duration,duration-stackChildrenDuration[stackTop]);--stackTop;if(node.depth===prevNode.depth){stackNodes.push(node);node=node.parent;}
  1852. prevNode=prevNode.parent;}
  1853. while(stackNodes.length){node=stackNodes.pop();openFrameCallback(node.depth,node,sampleTime);stackStartTimes[++stackTop]=sampleTime;stackChildrenDuration[stackTop]=0;}
  1854. prevId=id;}
  1855. if(idToNode[prevId]===gcNode){var start=stackStartTimes[stackTop];var duration=sampleTime-start;stackChildrenDuration[stackTop-1]+=duration;closeFrameCallback(gcParentNode.depth+1,node,start,duration,duration-stackChildrenDuration[stackTop]);--stackTop;}
  1856. for(var node=idToNode[prevId];node.parent;node=node.parent){var start=stackStartTimes[stackTop];var duration=sampleTime-start;stackChildrenDuration[stackTop-1]+=duration;closeFrameCallback(node.depth,node,start,duration,duration-stackChildrenDuration[stackTop]);--stackTop;}},nodeByIndex:function(index)
  1857. {return this._idToNode[this.samples[index]];}};WebInspector.CPUProfilerModel=function(target)
  1858. {WebInspector.SDKModel.call(this,WebInspector.CPUProfilerModel,target);this._isRecording=false;target.registerProfilerDispatcher(this);target.profilerAgent().enable();this._configureCpuProfilerSamplingInterval();WebInspector.settings.highResolutionCpuProfiling.addChangeListener(this._configureCpuProfilerSamplingInterval,this);}
  1859. WebInspector.CPUProfilerModel.EventTypes={ProfileStarted:"ProfileStarted",ProfileStopped:"ProfileStopped",ConsoleProfileStarted:"ConsoleProfileStarted",ConsoleProfileFinished:"ConsoleProfileFinished"};WebInspector.CPUProfilerModel.prototype={_configureCpuProfilerSamplingInterval:function()
  1860. {var intervalUs=WebInspector.settings.highResolutionCpuProfiling.get()?100:1000;this.target().profilerAgent().setSamplingInterval(intervalUs);},consoleProfileFinished:function(id,scriptLocation,cpuProfile,title)
  1861. {self.runtime.loadModulePromise("profiler").then(dispatchEvent.bind(this));function dispatchEvent()
  1862. {var debuggerLocation=WebInspector.DebuggerModel.Location.fromPayload(this.target(),scriptLocation);this.dispatchEventToListeners(WebInspector.CPUProfilerModel.EventTypes.ConsoleProfileFinished,{protocolId:id,scriptLocation:debuggerLocation,cpuProfile:cpuProfile,title:title});}},consoleProfileStarted:function(id,scriptLocation,title)
  1863. {self.runtime.loadModulePromise("profiler").then(dispatchEvent.bind(this));function dispatchEvent()
  1864. {var debuggerLocation=WebInspector.DebuggerModel.Location.fromPayload(this.target(),scriptLocation);this.dispatchEventToListeners(WebInspector.CPUProfilerModel.EventTypes.ConsoleProfileStarted,{protocolId:id,scriptLocation:debuggerLocation,title:title});}},isRecordingProfile:function()
  1865. {return this._isRecording;},startRecording:function()
  1866. {this._isRecording=true;this.target().profilerAgent().start();this.dispatchEventToListeners(WebInspector.CPUProfilerModel.EventTypes.ProfileStarted);WebInspector.userMetrics.ProfilesCPUProfileTaken.record();},stopRecording:function()
  1867. {function extractProfile(value)
  1868. {return value.profile;}
  1869. this._isRecording=false;this.dispatchEventToListeners(WebInspector.CPUProfilerModel.EventTypes.ProfileStopped);return this.target().profilerAgent().stop().then(extractProfile);},dispose:function()
  1870. {WebInspector.settings.highResolutionCpuProfiling.removeChangeListener(this._configureCpuProfilerSamplingInterval,this);},__proto__:WebInspector.SDKModel.prototype}
  1871. WebInspector.cpuProfilerModel;;WebInspector.CSSMetadata=function(properties)
  1872. {this._values=([]);this._longhands={};this._shorthands={};for(var i=0;i<properties.length;++i){var property=properties[i];if(typeof property==="string"){this._values.push(property);continue;}
  1873. var propertyName=property.name;this._values.push(propertyName);var longhands=properties[i].longhands;if(longhands){this._longhands[propertyName]=longhands;for(var j=0;j<longhands.length;++j){var longhandName=longhands[j];var shorthands=this._shorthands[longhandName];if(!shorthands){shorthands=[];this._shorthands[longhandName]=shorthands;}
  1874. shorthands.push(propertyName);}}}
  1875. this._values.sort();}
  1876. WebInspector.CSSMetadata.cssPropertiesMetainfo=new WebInspector.CSSMetadata([]);WebInspector.CSSMetadata.isColorAwareProperty=function(propertyName)
  1877. {return!!WebInspector.CSSMetadata._colorAwareProperties[propertyName.toLowerCase()];}
  1878. WebInspector.CSSMetadata.isLengthProperty=function(propertyName)
  1879. {if(propertyName==="line-height")
  1880. return false;if(!WebInspector.CSSMetadata._distancePropertiesKeySet)
  1881. WebInspector.CSSMetadata._distancePropertiesKeySet=WebInspector.CSSMetadata._distanceProperties.keySet();return WebInspector.CSSMetadata._distancePropertiesKeySet[propertyName]||propertyName.startsWith("margin")||propertyName.startsWith("padding")||propertyName.indexOf("width")!==-1||propertyName.indexOf("height")!==-1;}
  1882. WebInspector.CSSMetadata.InheritedProperties=["azimuth","border-collapse","border-spacing","caption-side","color","cursor","direction","elevation","empty-cells","font-family","font-size","font-style","font-variant","font-weight","font","letter-spacing","line-height","list-style-image","list-style-position","list-style-type","list-style","orphans","overflow-wrap","pitch-range","pitch","quotes","resize","richness","speak-header","speak-numeral","speak-punctuation","speak","speech-rate","stress","text-align","text-indent","text-transform","text-shadow","-webkit-user-select","visibility","voice-family","volume","white-space","widows","word-spacing","word-wrap","zoom"].keySet();WebInspector.CSSMetadata.NonStandardInheritedProperties=["-webkit-font-smoothing"].keySet();WebInspector.CSSMetadata.canonicalPropertyName=function(name)
  1883. {if(!name||name.length<9||name.charAt(0)!=="-")
  1884. return name.toLowerCase();var match=name.match(/(?:-webkit-)(.+)/);var propertiesSet=WebInspector.CSSMetadata.cssPropertiesMetainfoKeySet();var hasSupportedProperties=WebInspector.CSSMetadata.cssPropertiesMetainfo._values.length>0;if(!match||(hasSupportedProperties&&!propertiesSet.hasOwnProperty(match[1].toLowerCase())))
  1885. return name.toLowerCase();return match[1].toLowerCase();}
  1886. WebInspector.CSSMetadata.isPropertyInherited=function(propertyName)
  1887. {return!!(WebInspector.CSSMetadata.InheritedProperties[WebInspector.CSSMetadata.canonicalPropertyName(propertyName)]||WebInspector.CSSMetadata.NonStandardInheritedProperties[propertyName.toLowerCase()]);}
  1888. WebInspector.CSSMetadata._distanceProperties=['background-position','border-spacing','bottom','font-size','height','left','letter-spacing','max-height','max-width','min-height','min-width','right','text-indent','top','width','word-spacing'];WebInspector.CSSMetadata._colorAwareProperties=["background","background-color","background-image","border","border-color","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","box-shadow","color","fill","outline","outline-color","stroke","text-shadow","-webkit-box-shadow","-webkit-column-rule-color","-webkit-text-decoration-color","-webkit-text-emphasis","-webkit-text-emphasis-color"].keySet();WebInspector.CSSMetadata._propertyDataMap={"table-layout":{values:["auto","fixed"]},"visibility":{values:["hidden","visible","collapse"]},"background-repeat":{values:["repeat","repeat-x","repeat-y","no-repeat","space","round"]},"content":{values:["list-item","close-quote","no-close-quote","no-open-quote","open-quote"]},"list-style-image":{values:["none"]},"clear":{values:["none","left","right","both"]},"overflow-x":{values:["hidden","auto","visible","overlay","scroll"]},"stroke-linejoin":{values:["round","miter","bevel"]},"baseline-shift":{values:["baseline","sub","super"]},"border-bottom-width":{values:["medium","thick","thin"]},"margin-top-collapse":{values:["collapse","separate","discard"]},"max-height":{values:["none"]},"box-orient":{values:["horizontal","vertical","inline-axis","block-axis"],},"font-stretch":{values:["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded"]},"-webkit-background-composite":{values:["highlight","clear","copy","source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","xor","plus-darker","plus-lighter"]},"border-left-width":{values:["medium","thick","thin"]},"box-shadow":{values:["inset","none"]},"-webkit-writing-mode":{values:["lr","rl","tb","lr-tb","rl-tb","tb-rl","horizontal-tb","vertical-rl","vertical-lr","horizontal-bt"]},"border-collapse":{values:["collapse","separate"]},"page-break-inside":{values:["auto","avoid"]},"border-top-width":{values:["medium","thick","thin"]},"outline-color":{values:["invert"]},"outline-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"cursor":{values:["none","copy","auto","crosshair","default","pointer","move","vertical-text","cell","context-menu","alias","progress","no-drop","not-allowed","-webkit-zoom-in","-webkit-zoom-out","e-resize","ne-resize","nw-resize","n-resize","se-resize","sw-resize","s-resize","w-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","col-resize","row-resize","text","wait","help","all-scroll","-webkit-grab","-webkit-grabbing"]},"border-width":{values:["medium","thick","thin"]},"border-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"size":{values:["a3","a4","a5","b4","b5","landscape","ledger","legal","letter","portrait"]},"background-size":{values:["contain","cover"]},"direction":{values:["ltr","rtl"]},"enable-background":{values:["accumulate","new"]},"float":{values:["none","left","right"]},"overflow-y":{values:["hidden","auto","visible","overlay","scroll"]},"margin-bottom-collapse":{values:["collapse","separate","discard"]},"box-reflect":{values:["left","right","above","below"]},"overflow":{values:["hidden","auto","visible","overlay","scroll"]},"text-rendering":{values:["auto","optimizeSpeed","optimizeLegibility","geometricPrecision"]},"text-align":{values:["-webkit-auto","start","end","left","right","center","justify","-webkit-left","-webkit-right","-webkit-center"]},"list-style-position":{values:["outside","inside","hanging"]},"margin-bottom":{values:["auto"]},"color-interpolation":{values:["linearrgb"]},"background-origin":{values:["border-box","content-box","padding-box"]},"word-wrap":{values:["normal","break-word"]},"font-weight":{values:["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},"margin-before-collapse":{values:["collapse","separate","discard"]},"text-transform":{values:["none","capitalize","uppercase","lowercase"]},"border-right-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"border-left-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"-webkit-text-emphasis":{values:["circle","filled","open","dot","double-circle","triangle","sesame"]},"font-style":{values:["italic","oblique","normal"]},"speak":{values:["none","normal","spell-out","digits","literal-punctuation","no-punctuation"]},"color-rendering":{values:["auto","optimizeSpeed","optimizeQuality"]},"list-style-type":{values:["none","inline","disc","circle","square","decimal","decimal-leading-zero","arabic-indic","binary","bengali","cambodian","khmer","devanagari","gujarati","gurmukhi","kannada","lower-hexadecimal","lao","malayalam","mongolian","myanmar","octal","oriya","persian","urdu","telugu","tibetan","thai","upper-hexadecimal","lower-roman","upper-roman","lower-greek","lower-alpha","lower-latin","upper-alpha","upper-latin","afar","ethiopic-halehame-aa-et","ethiopic-halehame-aa-er","amharic","ethiopic-halehame-am-et","amharic-abegede","ethiopic-abegede-am-et","cjk-earthly-branch","cjk-heavenly-stem","ethiopic","ethiopic-halehame-gez","ethiopic-abegede","ethiopic-abegede-gez","hangul-consonant","hangul","lower-norwegian","oromo","ethiopic-halehame-om-et","sidama","ethiopic-halehame-sid-et","somali","ethiopic-halehame-so-et","tigre","ethiopic-halehame-tig","tigrinya-er","ethiopic-halehame-ti-er","tigrinya-er-abegede","ethiopic-abegede-ti-er","tigrinya-et","ethiopic-halehame-ti-et","tigrinya-et-abegede","ethiopic-abegede-ti-et","upper-greek","upper-norwegian","asterisks","footnotes","hebrew","armenian","lower-armenian","upper-armenian","georgian","cjk-ideographic","hiragana","katakana","hiragana-iroha","katakana-iroha"]},"-webkit-text-combine":{values:["none","horizontal"]},"outline":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"font":{values:["caption","icon","menu","message-box","small-caption","-webkit-mini-control","-webkit-small-control","-webkit-control","status-bar","italic","oblique","small-caps","normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900","xx-small","x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large","smaller","larger","serif","sans-serif","cursive","fantasy","monospace","-webkit-body","-webkit-pictograph"]},"dominant-baseline":{values:["middle","auto","central","text-before-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","use-script","no-change","reset-size"]},"display":{values:["none","inline","block","list-item","run-in","compact","inline-block","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","-webkit-box","-webkit-inline-box","flex","inline-flex","grid","inline-grid"]},"-webkit-text-emphasis-position":{values:["over","under"]},"image-rendering":{values:["auto","optimizeSpeed","optimizeQuality","pixelated"]},"alignment-baseline":{values:["baseline","middle","auto","before-edge","after-edge","central","text-before-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical"]},"outline-width":{values:["medium","thick","thin"]},"box-align":{values:["baseline","center","stretch","start","end"]},"border-right-width":{values:["medium","thick","thin"]},"border-top-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"line-height":{values:["normal"]},"text-overflow":{values:["clip","ellipsis"]},"overflow-wrap":{values:["normal","break-word"]},"box-direction":{values:["normal","reverse"]},"margin-after-collapse":{values:["collapse","separate","discard"]},"page-break-before":{values:["left","right","auto","always","avoid"]},"border-image":{values:["repeat","stretch"]},"text-decoration":{values:["blink","line-through","overline","underline"]},"position":{values:["absolute","fixed","relative","static"]},"font-family":{values:["serif","sans-serif","cursive","fantasy","monospace","-webkit-body","-webkit-pictograph"]},"text-overflow-mode":{values:["clip","ellipsis"]},"border-bottom-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"unicode-bidi":{values:["normal","bidi-override","embed","isolate","isolate-override","plaintext"]},"clip-rule":{values:["nonzero","evenodd"]},"margin-left":{values:["auto"]},"margin-top":{values:["auto"]},"zoom":{values:["normal","document","reset"]},"max-width":{values:["none"]},"caption-side":{values:["top","bottom"]},"empty-cells":{values:["hide","show"]},"pointer-events":{values:["none","all","auto","visible","visiblepainted","visiblefill","visiblestroke","painted","fill","stroke","bounding-box"]},"letter-spacing":{values:["normal"]},"background-clip":{values:["border-box","content-box","padding-box"]},"-webkit-font-smoothing":{values:["none","auto","antialiased","subpixel-antialiased"]},"border":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"font-size":{values:["xx-small","x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large","smaller","larger"]},"font-variant":{values:["small-caps","normal"]},"vertical-align":{values:["baseline","middle","sub","super","text-top","text-bottom","top","bottom","-webkit-baseline-middle"]},"white-space":{values:["normal","nowrap","pre","pre-line","pre-wrap"]},"box-lines":{values:["single","multiple"]},"page-break-after":{values:["left","right","auto","always","avoid"]},"clip-path":{values:["none"]},"margin":{values:["auto"]},"margin-right":{values:["auto"]},"word-break":{values:["normal","break-all","break-word"]},"word-spacing":{values:["normal"]},"-webkit-text-emphasis-style":{values:["circle","filled","open","dot","double-circle","triangle","sesame"]},"transform":{values:["scale","scaleX","scaleY","scale3d","rotate","rotateX","rotateY","rotateZ","rotate3d","skew","skewX","skewY","translate","translateX","translateY","translateZ","translate3d","matrix","matrix3d","perspective"]},"image-resolution":{values:["from-image","snap"]},"box-sizing":{values:["content-box","border-box"]},"clip":{values:["auto"]},"resize":{values:["none","both","horizontal","vertical"]},"align-content":{values:["flex-start","flex-end","center","space-between","space-around","stretch"]},"align-items":{values:["flex-start","flex-end","center","baseline","stretch"]},"align-self":{values:["auto","flex-start","flex-end","center","baseline","stretch"]},"flex-direction":{values:["row","row-reverse","column","column-reverse"]},"justify-content":{values:["flex-start","flex-end","center","space-between","space-around"]},"flex-wrap":{values:["nowrap","wrap","wrap-reverse"]},"-webkit-animation-timing-function":{values:["ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps","cubic-bezier"]},"-webkit-animation-direction":{values:["normal","reverse","alternate","alternate-reverse"]},"-webkit-animation-play-state":{values:["running","paused"]},"-webkit-animation-fill-mode":{values:["none","forwards","backwards","both"]},"-webkit-backface-visibility":{values:["visible","hidden"]},"-webkit-box-decoration-break":{values:["slice","clone"]},"-webkit-column-break-after":{values:["auto","always","avoid","left","right","page","column","avoid-page","avoid-column"]},"-webkit-column-break-before":{values:["auto","always","avoid","left","right","page","column","avoid-page","avoid-column"]},"-webkit-column-break-inside":{values:["auto","avoid","avoid-page","avoid-column"]},"-webkit-column-span":{values:["none","all"]},"-webkit-column-count":{values:["auto"]},"-webkit-column-gap":{values:["normal"]},"-webkit-line-break":{values:["auto","loose","normal","strict"]},"-webkit-perspective":{values:["none"]},"-webkit-perspective-origin":{values:["left","center","right","top","bottom"]},"text-align-last":{values:["auto","start","end","left","right","center","justify"]},"-webkit-text-decoration-line":{values:["none","underline","overline","line-through","blink"]},"-webkit-text-decoration-style":{values:["solid","double","dotted","dashed","wavy"]},"-webkit-text-decoration-skip":{values:["none","objects","spaces","ink","edges","box-decoration"]},"-webkit-transform-origin":{values:["left","center","right","top","bottom"]},"-webkit-transform-style":{values:["flat","preserve-3d"]},"-webkit-transition-timing-function":{values:["ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps","cubic-bezier"]},"-webkit-flex":{m:"flexbox"},"-webkit-flex-basis":{m:"flexbox"},"-webkit-flex-flow":{m:"flexbox"},"-webkit-flex-grow":{m:"flexbox"},"-webkit-flex-shrink":{m:"flexbox"},"-webkit-animation":{m:"animations"},"-webkit-animation-delay":{m:"animations"},"-webkit-animation-duration":{m:"animations"},"-webkit-animation-iteration-count":{m:"animations"},"-webkit-animation-name":{m:"animations"},"-webkit-column-rule":{m:"multicol"},"-webkit-column-rule-color":{m:"multicol",a:"crc"},"-webkit-column-rule-style":{m:"multicol",a:"crs"},"-webkit-column-rule-width":{m:"multicol",a:"crw"},"-webkit-column-width":{m:"multicol",a:"cw"},"-webkit-columns":{m:"multicol"},"-webkit-order":{m:"flexbox"},"-webkit-text-decoration-color":{m:"text-decor"},"-webkit-text-emphasis-color":{m:"text-decor"},"-webkit-transition":{m:"transitions"},"-webkit-transition-delay":{m:"transitions"},"-webkit-transition-duration":{m:"transitions"},"-webkit-transition-property":{m:"transitions"},"background":{m:"background"},"background-attachment":{m:"background"},"background-color":{m:"background"},"background-image":{m:"background"},"background-position":{m:"background"},"background-position-x":{m:"background"},"background-position-y":{m:"background"},"background-repeat-x":{m:"background"},"background-repeat-y":{m:"background"},"border-top":{m:"background"},"border-right":{m:"background"},"border-bottom":{m:"background"},"border-left":{m:"background"},"border-radius":{m:"background"},"bottom":{m:"visuren"},"color":{m:"color",a:"foreground"},"counter-increment":{m:"generate"},"counter-reset":{m:"generate"},"grid-template-columns":{m:"grid"},"grid-template-rows":{m:"grid"},"height":{m:"box"},"image-orientation":{m:"images"},"left":{m:"visuren"},"list-style":{m:"lists"},"min-height":{m:"box"},"min-width":{m:"box"},"opacity":{m:"color",a:"transparency"},"orphans":{m:"page"},"outline-offset":{m:"ui"},"padding":{m:"box",a:"padding1"},"padding-bottom":{m:"box"},"padding-left":{m:"box"},"padding-right":{m:"box"},"padding-top":{m:"box"},"page":{m:"page"},"quotes":{m:"generate"},"right":{m:"visuren"},"tab-size":{m:"text"},"text-indent":{m:"text"},"text-shadow":{m:"text-decor"},"top":{m:"visuren"},"unicode-range":{m:"fonts",a:"descdef-unicode-range"},"widows":{m:"page"},"width":{m:"box"},"z-index":{m:"visuren"}}
  1889. WebInspector.CSSMetadata.keywordsForProperty=function(propertyName)
  1890. {var acceptedKeywords=["inherit","initial"];var descriptor=WebInspector.CSSMetadata.descriptor(propertyName);if(descriptor&&descriptor.values)
  1891. acceptedKeywords.push.apply(acceptedKeywords,descriptor.values);if(WebInspector.CSSMetadata.isColorAwareProperty(propertyName)){acceptedKeywords.push("currentColor");for(var color in WebInspector.Color.Nicknames)
  1892. acceptedKeywords.push(color);}
  1893. return new WebInspector.CSSMetadata(acceptedKeywords);}
  1894. WebInspector.CSSMetadata.descriptor=function(propertyName)
  1895. {if(!propertyName)
  1896. return null;var unprefixedName=propertyName.replace(/^-webkit-/,"");propertyName=propertyName.toLowerCase();var entry=WebInspector.CSSMetadata._propertyDataMap[propertyName];if(!entry&&unprefixedName!==propertyName)
  1897. entry=WebInspector.CSSMetadata._propertyDataMap[unprefixedName];return entry||null;}
  1898. WebInspector.CSSMetadata.initializeWithSupportedProperties=function(properties)
  1899. {WebInspector.CSSMetadata.cssPropertiesMetainfo=new WebInspector.CSSMetadata(properties);}
  1900. WebInspector.CSSMetadata.cssPropertiesMetainfoKeySet=function()
  1901. {if(!WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet)
  1902. WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet=WebInspector.CSSMetadata.cssPropertiesMetainfo.keySet();return WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet;}
  1903. WebInspector.CSSMetadata.Weight={"-webkit-animation":1,"-webkit-animation-duration":1,"-webkit-animation-iteration-count":1,"-webkit-animation-name":1,"-webkit-animation-timing-function":1,"-webkit-appearance":1,"-webkit-background-clip":2,"-webkit-border-horizontal-spacing":1,"-webkit-border-vertical-spacing":1,"-webkit-box-shadow":24,"-webkit-font-smoothing":2,"-webkit-transition":8,"-webkit-transition-delay":7,"-webkit-transition-duration":7,"-webkit-transition-property":7,"-webkit-transition-timing-function":6,"-webkit-user-select":1,"background":222,"background-attachment":144,"background-clip":143,"background-color":222,"background-image":201,"background-origin":142,"background-size":25,"border":121,"border-bottom":121,"border-bottom-color":121,"border-bottom-left-radius":50,"border-bottom-right-radius":50,"border-bottom-style":114,"border-bottom-width":120,"border-collapse":3,"border-left":95,"border-left-color":95,"border-left-style":89,"border-left-width":94,"border-radius":50,"border-right":93,"border-right-color":93,"border-right-style":88,"border-right-width":93,"border-top":111,"border-top-color":111,"border-top-left-radius":49,"border-top-right-radius":49,"border-top-style":104,"border-top-width":109,"bottom":16,"box-shadow":25,"box-sizing":2,"clear":23,"color":237,"cursor":34,"direction":4,"display":210,"fill":2,"filter":1,"float":105,"font":174,"font-family":25,"font-size":174,"font-style":9,"font-weight":89,"height":161,"left":54,"letter-spacing":3,"line-height":75,"list-style":17,"list-style-image":8,"list-style-position":8,"list-style-type":17,"margin":241,"margin-bottom":226,"margin-left":225,"margin-right":213,"margin-top":241,"max-height":5,"max-width":11,"min-height":9,"min-width":6,"opacity":24,"outline":10,"outline-color":10,"outline-style":10,"outline-width":10,"overflow":57,"overflow-x":56,"overflow-y":57,"padding":216,"padding-bottom":208,"padding-left":216,"padding-right":206,"padding-top":216,"position":136,"resize":1,"right":29,"stroke":1,"stroke-width":1,"table-layout":1,"text-align":66,"text-decoration":53,"text-indent":9,"text-overflow":8,"text-shadow":19,"text-transform":5,"top":71,"transform":1,"unicode-bidi":1,"vertical-align":37,"visibility":11,"white-space":24,"width":255,"word-wrap":6,"z-index":32,"zoom":10};WebInspector.CSSMetadata.prototype={startsWith:function(prefix)
  1904. {var firstIndex=this._firstIndexOfPrefix(prefix);if(firstIndex===-1)
  1905. return[];var results=[];while(firstIndex<this._values.length&&this._values[firstIndex].startsWith(prefix))
  1906. results.push(this._values[firstIndex++]);return results;},mostUsedOf:function(properties)
  1907. {var maxWeight=0;var index=0;for(var i=0;i<properties.length;i++){var weight=WebInspector.CSSMetadata.Weight[properties[i]];if(!weight)
  1908. weight=WebInspector.CSSMetadata.Weight[WebInspector.CSSMetadata.canonicalPropertyName(properties[i])];if(weight>maxWeight){maxWeight=weight;index=i;}}
  1909. return index;},_firstIndexOfPrefix:function(prefix)
  1910. {if(!this._values.length)
  1911. return-1;if(!prefix)
  1912. return 0;var maxIndex=this._values.length-1;var minIndex=0;var foundIndex;do{var middleIndex=(maxIndex+minIndex)>>1;if(this._values[middleIndex].startsWith(prefix)){foundIndex=middleIndex;break;}
  1913. if(this._values[middleIndex]<prefix)
  1914. minIndex=middleIndex+1;else
  1915. maxIndex=middleIndex-1;}while(minIndex<=maxIndex);if(foundIndex===undefined)
  1916. return-1;while(foundIndex&&this._values[foundIndex-1].startsWith(prefix))
  1917. foundIndex--;return foundIndex;},keySet:function()
  1918. {if(!this._keySet)
  1919. this._keySet=this._values.keySet();return this._keySet;},next:function(str,prefix)
  1920. {return this._closest(str,prefix,1);},previous:function(str,prefix)
  1921. {return this._closest(str,prefix,-1);},_closest:function(str,prefix,shift)
  1922. {if(!str)
  1923. return"";var index=this._values.indexOf(str);if(index===-1)
  1924. return"";if(!prefix){index=(index+this._values.length+shift)%this._values.length;return this._values[index];}
  1925. var propertiesWithPrefix=this.startsWith(prefix);var j=propertiesWithPrefix.indexOf(str);j=(j+propertiesWithPrefix.length+shift)%propertiesWithPrefix.length;return propertiesWithPrefix[j];},longhands:function(shorthand)
  1926. {return this._longhands[shorthand];},shorthands:function(longhand)
  1927. {return this._shorthands[longhand];}}
  1928. WebInspector.CSSMetadata.initializeWithSupportedProperties([]);;WebInspector.CSSParser=function()
  1929. {this._worker=new WorkerRuntime.Worker("script_formatter_worker");this._worker.onmessage=this._onRuleChunk.bind(this);this._rules=[];}
  1930. WebInspector.CSSParser.Events={RulesParsed:"RulesParsed"}
  1931. WebInspector.CSSParser.prototype={fetchAndParse:function(styleSheetHeader,callback)
  1932. {this._lock();this._finishedCallback=callback;styleSheetHeader.requestContent(this._innerParse.bind(this));},parse:function(text,callback)
  1933. {this._lock();this._finishedCallback=callback;this._innerParse(text);},dispose:function()
  1934. {if(this._worker){this._worker.terminate();delete this._worker;}},rules:function()
  1935. {return this._rules;},_lock:function()
  1936. {console.assert(!this._parsingStyleSheet,"Received request to parse stylesheet before previous was completed.");this._parsingStyleSheet=true;},_unlock:function()
  1937. {delete this._parsingStyleSheet;},_innerParse:function(text)
  1938. {this._rules=[];this._worker.postMessage({method:"parseCSS",params:{content:text}});},_onRuleChunk:function(event)
  1939. {var data=(event.data);var chunk=data.chunk;for(var i=0;i<chunk.length;++i)
  1940. this._rules.push(chunk[i]);if(data.isLastChunk)
  1941. this._onFinishedParsing();this.dispatchEventToListeners(WebInspector.CSSParser.Events.RulesParsed);},_onFinishedParsing:function()
  1942. {this._unlock();if(this._finishedCallback)
  1943. this._finishedCallback(this._rules);},__proto__:WebInspector.Object.prototype,}
  1944. WebInspector.CSSParser.DataChunk;WebInspector.CSSParser.StyleRule;WebInspector.CSSParser.AtRule;WebInspector.CSSParser.Rule;WebInspector.CSSParser.Property;;WebInspector.CSSStyleModel=function(target)
  1945. {WebInspector.SDKModel.call(this,WebInspector.CSSStyleModel,target);this._domModel=target.domModel;this._agent=target.cssAgent();this._pendingCommandsMajorState=[];this._styleLoader=new WebInspector.CSSStyleModel.ComputedStyleLoader(this);this._domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoRequested,this._undoRedoRequested,this);this._domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoCompleted,this._undoRedoCompleted,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);target.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));this._agent.enable(this._wasEnabled.bind(this));this._styleSheetIdToHeader=new Map();this._styleSheetIdsForURL=new Map();}
  1946. WebInspector.CSSStyleModel.PseudoStatePropertyName="pseudoState";WebInspector.CSSStyleModel.parseRuleMatchArrayPayload=function(cssModel,matchArray)
  1947. {if(!matchArray)
  1948. return[];var result=[];for(var i=0;i<matchArray.length;++i)
  1949. result.push(WebInspector.CSSRule.parsePayload(cssModel,matchArray[i].rule,matchArray[i].matchingSelectors));return result;}
  1950. WebInspector.CSSStyleModel.Events={ModelWasEnabled:"ModelWasEnabled",StyleSheetAdded:"StyleSheetAdded",StyleSheetChanged:"StyleSheetChanged",StyleSheetRemoved:"StyleSheetRemoved",MediaQueryResultChanged:"MediaQueryResultChanged",}
  1951. WebInspector.CSSStyleModel.MediaTypes=["all","braille","embossed","handheld","print","projection","screen","speech","tty","tv"];WebInspector.CSSStyleModel.prototype={suspendModel:function()
  1952. {this._agent.disable();this._isEnabled=false;this._resetStyleSheets();},resumeModel:function()
  1953. {this._agent.enable(this._wasEnabled.bind(this));},getMediaQueries:function(userCallback)
  1954. {function callback(error,payload)
  1955. {var models=[];if(!error&&payload)
  1956. models=WebInspector.CSSMedia.parseMediaArrayPayload(this,payload);userCallback(models);}
  1957. this._agent.getMediaQueries(callback.bind(this));},isEnabled:function()
  1958. {return this._isEnabled;},_wasEnabled:function()
  1959. {this._isEnabled=true;this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.ModelWasEnabled);},getMatchedStylesAsync:function(nodeId,excludePseudo,excludeInherited,userCallback)
  1960. {function callback(userCallback,error,matchedPayload,pseudoPayload,inheritedPayload)
  1961. {if(error){if(userCallback)
  1962. userCallback(null);return;}
  1963. var result={};result.matchedCSSRules=WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(this,matchedPayload);result.pseudoElements=[];if(pseudoPayload){for(var i=0;i<pseudoPayload.length;++i){var entryPayload=pseudoPayload[i];result.pseudoElements.push({pseudoId:entryPayload.pseudoId,rules:WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(this,entryPayload.matches)});}}
  1964. result.inherited=[];if(inheritedPayload){for(var i=0;i<inheritedPayload.length;++i){var entryPayload=inheritedPayload[i];var entry={};if(entryPayload.inlineStyle)
  1965. entry.inlineStyle=WebInspector.CSSStyleDeclaration.parsePayload(this,entryPayload.inlineStyle);if(entryPayload.matchedCSSRules)
  1966. entry.matchedCSSRules=WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(this,entryPayload.matchedCSSRules);result.inherited.push(entry);}}
  1967. if(userCallback)
  1968. userCallback(result);}
  1969. this._agent.getMatchedStylesForNode(nodeId,excludePseudo,excludeInherited,callback.bind(this,userCallback));},getComputedStyleAsync:function(nodeId,userCallback)
  1970. {this._styleLoader.getComputedStyle(nodeId,userCallback);},getPlatformFontsForNode:function(nodeId,callback)
  1971. {function platformFontsCallback(error,cssFamilyName,fonts)
  1972. {if(error)
  1973. callback(null,null);else
  1974. callback(cssFamilyName,fonts);}
  1975. this._agent.getPlatformFontsForNode(nodeId,platformFontsCallback);},allStyleSheets:function()
  1976. {var values=this._styleSheetIdToHeader.valuesArray();function styleSheetComparator(a,b)
  1977. {if(a.sourceURL<b.sourceURL)
  1978. return-1;else if(a.sourceURL>b.sourceURL)
  1979. return 1;return a.startLine-b.startLine||a.startColumn-b.startColumn;}
  1980. values.sort(styleSheetComparator);return values;},getInlineStylesAsync:function(nodeId,userCallback)
  1981. {function callback(userCallback,error,inlinePayload,attributesStylePayload)
  1982. {if(error||!inlinePayload)
  1983. userCallback(null,null);else
  1984. userCallback(WebInspector.CSSStyleDeclaration.parsePayload(this,inlinePayload),attributesStylePayload?WebInspector.CSSStyleDeclaration.parsePayload(this,attributesStylePayload):null);}
  1985. this._agent.getInlineStylesForNode(nodeId,callback.bind(this,userCallback));},forcePseudoState:function(node,pseudoClass,enable)
  1986. {var pseudoClasses=node.getUserProperty(WebInspector.CSSStyleModel.PseudoStatePropertyName)||[];if(enable){if(pseudoClasses.indexOf(pseudoClass)>=0)
  1987. return false;pseudoClasses.push(pseudoClass);node.setUserProperty(WebInspector.CSSStyleModel.PseudoStatePropertyName,pseudoClasses);}else{if(pseudoClasses.indexOf(pseudoClass)<0)
  1988. return false;pseudoClasses.remove(pseudoClass);if(!pseudoClasses.length)
  1989. node.removeUserProperty(WebInspector.CSSStyleModel.PseudoStatePropertyName);}
  1990. this._agent.forcePseudoState(node.id,pseudoClasses);return true;},setRuleSelector:function(rule,nodeId,newSelector,successCallback,failureCallback)
  1991. {function callback(nodeId,successCallback,failureCallback,newSelector,error,rulePayload)
  1992. {this._pendingCommandsMajorState.pop();if(error){failureCallback();return;}
  1993. this._domModel.markUndoableState();this._computeMatchingSelectors(rulePayload,nodeId,successCallback,failureCallback);}
  1994. if(!rule.styleSheetId)
  1995. throw"No rule stylesheet id";this._pendingCommandsMajorState.push(true);this._agent.setRuleSelector(rule.styleSheetId,rule.selectorRange,newSelector,callback.bind(this,nodeId,successCallback,failureCallback,newSelector));},setMediaText:function(media,newMediaText,successCallback,failureCallback)
  1996. {function callback(successCallback,failureCallback,error,mediaPayload)
  1997. {this._pendingCommandsMajorState.pop();if(error){failureCallback();return;}
  1998. this._domModel.markUndoableState();successCallback(WebInspector.CSSMedia.parsePayload(this,mediaPayload));}
  1999. console.assert(!!media.parentStyleSheetId);this._pendingCommandsMajorState.push(true);this._agent.setMediaText(media.parentStyleSheetId,media.range,newMediaText,callback.bind(this,successCallback,failureCallback));},_computeMatchingSelectors:function(rulePayload,nodeId,successCallback,failureCallback)
  2000. {var ownerDocumentId=this._ownerDocumentId(nodeId);if(!ownerDocumentId){failureCallback();return;}
  2001. var rule=WebInspector.CSSRule.parsePayload(this,rulePayload);var matchingSelectors=[];var allSelectorsBarrier=new CallbackBarrier();for(var i=0;i<rule.selectors.length;++i){var selector=rule.selectors[i];var boundCallback=allSelectorsBarrier.createCallback(selectorQueried.bind(null,i,nodeId,matchingSelectors));this._domModel.querySelectorAll(ownerDocumentId,selector.value,boundCallback);}
  2002. allSelectorsBarrier.callWhenDone(function(){rule.matchingSelectors=matchingSelectors;successCallback(rule);});function selectorQueried(index,nodeId,matchingSelectors,matchingNodeIds)
  2003. {if(!matchingNodeIds)
  2004. return;if(matchingNodeIds.indexOf(nodeId)!==-1)
  2005. matchingSelectors.push(index);}},addRule:function(styleSheetId,node,ruleText,ruleLocation,successCallback,failureCallback)
  2006. {this._pendingCommandsMajorState.push(true);this._agent.addRule(styleSheetId,ruleText,ruleLocation,callback.bind(this));function callback(error,rulePayload)
  2007. {this._pendingCommandsMajorState.pop();if(error){failureCallback();}else{this._domModel.markUndoableState();this._computeMatchingSelectors(rulePayload,node.id,successCallback,failureCallback);}}},requestViaInspectorStylesheet:function(node,callback)
  2008. {var frameId=node.frameId()||this.target().resourceTreeModel.mainFrame.id;var headers=this._styleSheetIdToHeader.valuesArray();for(var i=0;i<headers.length;++i){var styleSheetHeader=headers[i];if(styleSheetHeader.frameId===frameId&&styleSheetHeader.isViaInspector()){callback(styleSheetHeader);return;}}
  2009. function innerCallback(error,styleSheetId)
  2010. {if(error){console.error(error);callback(null);}
  2011. callback(this._styleSheetIdToHeader.get(styleSheetId)||null);}
  2012. this._agent.createStyleSheet(frameId,innerCallback.bind(this));},mediaQueryResultChanged:function()
  2013. {this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged);},styleSheetHeaderForId:function(id)
  2014. {return this._styleSheetIdToHeader.get(id)||null;},styleSheetHeaders:function()
  2015. {return this._styleSheetIdToHeader.valuesArray();},_ownerDocumentId:function(nodeId)
  2016. {var node=this._domModel.nodeForId(nodeId);if(!node)
  2017. return null;return node.ownerDocument?node.ownerDocument.id:null;},_fireStyleSheetChanged:function(styleSheetId)
  2018. {if(!this._pendingCommandsMajorState.length)
  2019. return;var majorChange=this._pendingCommandsMajorState[this._pendingCommandsMajorState.length-1];if(!styleSheetId||!this.hasEventListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged))
  2020. return;this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged,{styleSheetId:styleSheetId,majorChange:majorChange});},_styleSheetAdded:function(header)
  2021. {console.assert(!this._styleSheetIdToHeader.get(header.styleSheetId));var styleSheetHeader=new WebInspector.CSSStyleSheetHeader(this,header);this._styleSheetIdToHeader.set(header.styleSheetId,styleSheetHeader);var url=styleSheetHeader.resourceURL();if(!this._styleSheetIdsForURL.get(url))
  2022. this._styleSheetIdsForURL.set(url,{});var frameIdToStyleSheetIds=this._styleSheetIdsForURL.get(url);var styleSheetIds=frameIdToStyleSheetIds[styleSheetHeader.frameId];if(!styleSheetIds){styleSheetIds=[];frameIdToStyleSheetIds[styleSheetHeader.frameId]=styleSheetIds;}
  2023. styleSheetIds.push(styleSheetHeader.id);this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetAdded,styleSheetHeader);},_styleSheetRemoved:function(id)
  2024. {var header=this._styleSheetIdToHeader.get(id);console.assert(header);if(!header)
  2025. return;this._styleSheetIdToHeader.remove(id);var url=header.resourceURL();var frameIdToStyleSheetIds=(this._styleSheetIdsForURL.get(url));console.assert(frameIdToStyleSheetIds,"No frameId to styleSheetId map is available for given style sheet URL.");frameIdToStyleSheetIds[header.frameId].remove(id);if(!frameIdToStyleSheetIds[header.frameId].length){delete frameIdToStyleSheetIds[header.frameId];if(!Object.keys(frameIdToStyleSheetIds).length)
  2026. this._styleSheetIdsForURL.remove(url);}
  2027. this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,header);},styleSheetIdsForURL:function(url)
  2028. {var frameIdToStyleSheetIds=this._styleSheetIdsForURL.get(url);if(!frameIdToStyleSheetIds)
  2029. return[];var result=[];for(var frameId in frameIdToStyleSheetIds)
  2030. result=result.concat(frameIdToStyleSheetIds[frameId]);return result;},styleSheetIdsByFrameIdForURL:function(url)
  2031. {var styleSheetIdsForFrame=this._styleSheetIdsForURL.get(url);if(!styleSheetIdsForFrame)
  2032. return{};return styleSheetIdsForFrame;},setStyleSheetText:function(styleSheetId,newText,majorChange,userCallback)
  2033. {var header=this._styleSheetIdToHeader.get(styleSheetId);console.assert(header);this._pendingCommandsMajorState.push(majorChange);header.setContent(newText,callback.bind(this));function callback(error)
  2034. {this._pendingCommandsMajorState.pop();if(!error&&majorChange)
  2035. this._domModel.markUndoableState();if(!error&&userCallback)
  2036. userCallback(error);}},_undoRedoRequested:function()
  2037. {this._pendingCommandsMajorState.push(true);},_undoRedoCompleted:function()
  2038. {this._pendingCommandsMajorState.pop();},_mainFrameNavigated:function()
  2039. {this._resetStyleSheets();},_resetStyleSheets:function()
  2040. {var headers=this._styleSheetIdToHeader.valuesArray();this._styleSheetIdsForURL.clear();this._styleSheetIdToHeader.clear();for(var i=0;i<headers.length;++i)
  2041. this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,headers[i]);},__proto__:WebInspector.SDKModel.prototype}
  2042. WebInspector.CSSLocation=function(target,styleSheetId,url,lineNumber,columnNumber)
  2043. {WebInspector.SDKObject.call(this,target);this.styleSheetId=styleSheetId;this.url=url;this.lineNumber=lineNumber;this.columnNumber=columnNumber||0;}
  2044. WebInspector.CSSLocation.prototype={__proto__:WebInspector.SDKObject.prototype}
  2045. WebInspector.CSSStyleDeclaration=function(cssModel,payload)
  2046. {this._cssModel=cssModel;this.styleSheetId=payload.styleSheetId;this.range=payload.range?WebInspector.TextRange.fromObject(payload.range):null;this._shorthandValues=WebInspector.CSSStyleDeclaration.buildShorthandValueMap(payload.shorthandEntries);this._livePropertyMap={};this._allProperties=[];this.__disabledProperties={};var payloadPropertyCount=payload.cssProperties.length;for(var i=0;i<payloadPropertyCount;++i){var property=WebInspector.CSSProperty.parsePayload(this,i,payload.cssProperties[i]);this._allProperties.push(property);}
  2047. this._computeActiveProperties();var propertyIndex=0;for(var i=0;i<this._allProperties.length;++i){var property=this._allProperties[i];if(property.disabled)
  2048. this.__disabledProperties[i]=property;if(!property.active&&!property.styleBased)
  2049. continue;var name=property.name;this[propertyIndex]=name;this._livePropertyMap[name]=property;++propertyIndex;}
  2050. this.length=propertyIndex;if("cssText"in payload)
  2051. this.cssText=payload.cssText;}
  2052. WebInspector.CSSStyleDeclaration.createDummyStyle=function()
  2053. {var dummyPayload={shorthandEntries:[],cssProperties:[]};return new WebInspector.CSSStyleDeclaration(WebInspector.cssModel,dummyPayload);}
  2054. WebInspector.CSSStyleDeclaration.buildShorthandValueMap=function(shorthandEntries)
  2055. {var result={};for(var i=0;i<shorthandEntries.length;++i)
  2056. result[shorthandEntries[i].name]=shorthandEntries[i].value;return result;}
  2057. WebInspector.CSSStyleDeclaration.parsePayload=function(cssModel,payload)
  2058. {return new WebInspector.CSSStyleDeclaration(cssModel,payload);}
  2059. WebInspector.CSSStyleDeclaration.parseComputedStylePayload=function(cssModel,payload)
  2060. {var newPayload=({cssProperties:[],shorthandEntries:[],width:"",height:""});if(payload)
  2061. newPayload.cssProperties=(payload);return new WebInspector.CSSStyleDeclaration(cssModel,newPayload);}
  2062. WebInspector.CSSStyleDeclaration.prototype={target:function()
  2063. {return this._cssModel.target();},sourceStyleSheetEdited:function(styleSheetId,oldRange,newRange)
  2064. {if(this.styleSheetId!==styleSheetId)
  2065. return;if(this.range)
  2066. this.range=this.range.rebaseAfterTextEdit(oldRange,newRange);for(var i=0;i<this._allProperties.length;++i)
  2067. this._allProperties[i].sourceStyleSheetEdited(styleSheetId,oldRange,newRange);},_computeActiveProperties:function()
  2068. {var activeProperties={};for(var i=this._allProperties.length-1;i>=0;--i){var property=this._allProperties[i];if(property.styleBased||property.disabled)
  2069. continue;property._setActive(false);if(!property.parsedOk)
  2070. continue;var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(property.name);var activeProperty=activeProperties[canonicalName];if(!activeProperty||(!activeProperty.important&&property.important))
  2071. activeProperties[canonicalName]=property;}
  2072. for(var propertyName in activeProperties){var property=activeProperties[propertyName];property._setActive(true);}},get allProperties()
  2073. {return this._allProperties;},getLiveProperty:function(name)
  2074. {return this._livePropertyMap[name]||null;},getPropertyValue:function(name)
  2075. {var property=this._livePropertyMap[name];return property?property.value:"";},isPropertyImplicit:function(name)
  2076. {var property=this._livePropertyMap[name];return property?property.implicit:"";},longhandProperties:function(name)
  2077. {var longhands=WebInspector.CSSMetadata.cssPropertiesMetainfo.longhands(name);var result=[];for(var i=0;longhands&&i<longhands.length;++i){var property=this._livePropertyMap[longhands[i]];if(property)
  2078. result.push(property);}
  2079. return result;},shorthandValue:function(shorthandProperty)
  2080. {return this._shorthandValues[shorthandProperty];},propertyAt:function(index)
  2081. {return(index<this.allProperties.length)?this.allProperties[index]:null;},pastLastSourcePropertyIndex:function()
  2082. {for(var i=this.allProperties.length-1;i>=0;--i){if(this.allProperties[i].range)
  2083. return i+1;}
  2084. return 0;},_insertionRange:function(index)
  2085. {var property=this.propertyAt(index);return property&&property.range?property.range.collapseToStart():this.range.collapseToEnd();},newBlankProperty:function(index)
  2086. {index=(typeof index==="undefined")?this.pastLastSourcePropertyIndex():index;var property=new WebInspector.CSSProperty(this,index,"","",false,false,true,false,"",this._insertionRange(index));property._setActive(true);return property;},insertPropertyAt:function(index,name,value,userCallback)
  2087. {function callback(error,payload)
  2088. {this._cssModel._pendingCommandsMajorState.pop();if(!userCallback)
  2089. return;if(error){console.error(error);userCallback(null);}else
  2090. userCallback(WebInspector.CSSStyleDeclaration.parsePayload(this._cssModel,payload));}
  2091. if(!this.styleSheetId)
  2092. throw"No stylesheet id";this._cssModel._pendingCommandsMajorState.push(true);this._cssModel._agent.setPropertyText(this.styleSheetId,this._insertionRange(index),name+": "+value+";",callback.bind(this));},appendProperty:function(name,value,userCallback)
  2093. {this.insertPropertyAt(this.allProperties.length,name,value,userCallback);}}
  2094. WebInspector.CSSRuleSelector=function(payload)
  2095. {this.value=payload.value;if(payload.range)
  2096. this.range=WebInspector.TextRange.fromObject(payload.range);}
  2097. WebInspector.CSSRuleSelector.parsePayload=function(payload)
  2098. {return new WebInspector.CSSRuleSelector(payload);}
  2099. WebInspector.CSSRuleSelector.prototype={sourceStyleRuleEdited:function(oldRange,newRange)
  2100. {if(!this.range)
  2101. return;this.range=this.range.rebaseAfterTextEdit(oldRange,newRange);}}
  2102. WebInspector.CSSRule=function(cssModel,payload,matchingSelectors)
  2103. {this._cssModel=cssModel;this.styleSheetId=payload.styleSheetId;if(matchingSelectors)
  2104. this.matchingSelectors=matchingSelectors;this.selectors=[];for(var i=0;i<payload.selectorList.selectors.length;++i){var selectorPayload=payload.selectorList.selectors[i];this.selectors.push(WebInspector.CSSRuleSelector.parsePayload(selectorPayload));}
  2105. this.selectorText=this.selectors.select("value").join(", ");var firstRange=this.selectors[0].range;if(firstRange){var lastRange=this.selectors.peekLast().range;this.selectorRange=new WebInspector.TextRange(firstRange.startLine,firstRange.startColumn,lastRange.endLine,lastRange.endColumn);}
  2106. if(this.styleSheetId){var styleSheetHeader=cssModel.styleSheetHeaderForId(this.styleSheetId);this.sourceURL=styleSheetHeader.sourceURL;}
  2107. this.origin=payload.origin;this.style=WebInspector.CSSStyleDeclaration.parsePayload(this._cssModel,payload.style);this.style.parentRule=this;if(payload.media)
  2108. this.media=WebInspector.CSSMedia.parseMediaArrayPayload(cssModel,payload.media);this._setFrameId();}
  2109. WebInspector.CSSRule.parsePayload=function(cssModel,payload,matchingIndices)
  2110. {return new WebInspector.CSSRule(cssModel,payload,matchingIndices);}
  2111. WebInspector.CSSRule.prototype={sourceStyleSheetEdited:function(styleSheetId,oldRange,newRange)
  2112. {this._sourceStyleSheetEditedWithMedia(styleSheetId,oldRange,newRange,null,null);},_sourceStyleSheetEditedWithMedia:function(styleSheetId,oldRange,newRange,oldMedia,newMedia)
  2113. {if(this.styleSheetId===styleSheetId){if(this.selectorRange)
  2114. this.selectorRange=this.selectorRange.rebaseAfterTextEdit(oldRange,newRange);for(var i=0;i<this.selectors.length;++i)
  2115. this.selectors[i].sourceStyleRuleEdited(oldRange,newRange);}
  2116. if(this.media){for(var i=0;i<this.media.length;++i){if(oldMedia&&newMedia&&oldMedia.equal(this.media[i])){this.media[i]=newMedia;}else{this.media[i].sourceStyleSheetEdited(styleSheetId,oldRange,newRange);}}}
  2117. this.style.sourceStyleSheetEdited(styleSheetId,oldRange,newRange);},mediaEdited:function(oldMedia,newMedia)
  2118. {this._sourceStyleSheetEditedWithMedia((oldMedia.parentStyleSheetId),oldMedia.range,newMedia.range,oldMedia,newMedia);},_setFrameId:function()
  2119. {if(!this.styleSheetId)
  2120. return;var styleSheetHeader=this._cssModel.styleSheetHeaderForId(this.styleSheetId);this.frameId=styleSheetHeader.frameId;},resourceURL:function()
  2121. {if(!this.styleSheetId)
  2122. return"";var styleSheetHeader=this._cssModel.styleSheetHeaderForId(this.styleSheetId);return styleSheetHeader.resourceURL();},lineNumberInSource:function(selectorIndex)
  2123. {var selector=this.selectors[selectorIndex];if(!selector||!selector.range||!this.styleSheetId)
  2124. return 0;var styleSheetHeader=this._cssModel.styleSheetHeaderForId(this.styleSheetId);return styleSheetHeader.lineNumberInSource(selector.range.startLine);},columnNumberInSource:function(selectorIndex)
  2125. {var selector=this.selectors[selectorIndex];if(!selector||!selector.range||!this.styleSheetId)
  2126. return undefined;var styleSheetHeader=this._cssModel.styleSheetHeaderForId(this.styleSheetId);console.assert(styleSheetHeader);return styleSheetHeader.columnNumberInSource(selector.range.startLine,selector.range.startColumn);},rawSelectorLocation:function(index)
  2127. {var lineNumber=this.lineNumberInSource(index);var columnNumber=this.columnNumberInSource(index);return new WebInspector.CSSLocation(this._cssModel.target(),this.styleSheetId||null,this.resourceURL(),lineNumber,columnNumber);},get isUserAgent()
  2128. {return this.origin==="user-agent";},get isInjected()
  2129. {return this.origin==="injected";},get isViaInspector()
  2130. {return this.origin==="inspector";},get isRegular()
  2131. {return this.origin==="regular";}}
  2132. WebInspector.CSSProperty=function(ownerStyle,index,name,value,important,disabled,parsedOk,implicit,text,range)
  2133. {this.ownerStyle=ownerStyle;this.index=index;this.name=name;this.value=value;this.important=important;this.disabled=disabled;this.parsedOk=parsedOk;this.implicit=implicit;this.text=text;this.range=range?WebInspector.TextRange.fromObject(range):null;}
  2134. WebInspector.CSSProperty.parsePayload=function(ownerStyle,index,payload)
  2135. {var result=new WebInspector.CSSProperty(ownerStyle,index,payload.name,payload.value,payload.important||false,payload.disabled||false,("parsedOk"in payload)?!!payload.parsedOk:true,!!payload.implicit,payload.text,payload.range);return result;}
  2136. WebInspector.CSSProperty.prototype={sourceStyleSheetEdited:function(styleSheetId,oldRange,newRange)
  2137. {if(this.ownerStyle.styleSheetId!==styleSheetId)
  2138. return;if(this.range)
  2139. this.range=this.range.rebaseAfterTextEdit(oldRange,newRange);},_setActive:function(active)
  2140. {this._active=active;},get propertyText()
  2141. {if(this.text!==undefined)
  2142. return this.text;if(this.name==="")
  2143. return"";return this.name+": "+this.value+(this.important?" !important":"")+";";},get isLive()
  2144. {return this.active||this.styleBased;},get active()
  2145. {return typeof this._active==="boolean"&&this._active;},get styleBased()
  2146. {return!this.range;},get inactive()
  2147. {return typeof this._active==="boolean"&&!this._active;},setText:function(propertyText,majorChange,overwrite,userCallback)
  2148. {function enabledCallback(style)
  2149. {if(userCallback)
  2150. userCallback(style);}
  2151. function callback(error,stylePayload)
  2152. {this.ownerStyle._cssModel._pendingCommandsMajorState.pop();if(!error){if(majorChange)
  2153. this.ownerStyle._cssModel._domModel.markUndoableState();var style=WebInspector.CSSStyleDeclaration.parsePayload(this.ownerStyle._cssModel,stylePayload);var newProperty=style.allProperties[this.index];if(newProperty&&this.disabled&&!propertyText.match(/^\s*$/)){newProperty.setDisabled(false,enabledCallback);return;}
  2154. if(userCallback)
  2155. userCallback(style);}else{if(userCallback)
  2156. userCallback(null);}}
  2157. if(!this.ownerStyle)
  2158. throw"No ownerStyle for property";if(!this.ownerStyle.styleSheetId)
  2159. throw"No owner style id";var cssModel=this.ownerStyle._cssModel;cssModel._pendingCommandsMajorState.push(majorChange);var range=(this.range);cssModel._agent.setPropertyText(this.ownerStyle.styleSheetId,overwrite?range:range.collapseToStart(),propertyText,callback.bind(this));},setValue:function(newValue,majorChange,overwrite,userCallback)
  2160. {var text=this.name+": "+newValue+(this.important?" !important":"")+";";this.setText(text,majorChange,overwrite,userCallback);},setDisabled:function(disabled,userCallback)
  2161. {if(!this.ownerStyle&&userCallback)
  2162. userCallback(null);if(disabled===this.disabled){if(userCallback)
  2163. userCallback(this.ownerStyle);return;}
  2164. if(disabled)
  2165. this.setText("/* "+this.text+" */",true,true,userCallback);else
  2166. this.setText(this.text.substring(2,this.text.length-2).trim(),true,true,userCallback);}}
  2167. WebInspector.CSSMediaQuery=function(payload)
  2168. {this._active=payload.active;this._expressions=[];for(var j=0;j<payload.expressions.length;++j)
  2169. this._expressions.push(WebInspector.CSSMediaQueryExpression.parsePayload(payload.expressions[j]));}
  2170. WebInspector.CSSMediaQuery.parsePayload=function(payload)
  2171. {return new WebInspector.CSSMediaQuery(payload);}
  2172. WebInspector.CSSMediaQuery.prototype={active:function()
  2173. {return this._active;},expressions:function()
  2174. {return this._expressions;}}
  2175. WebInspector.CSSMediaQueryExpression=function(payload)
  2176. {this._value=payload.value;this._unit=payload.unit;this._feature=payload.feature;this._valueRange=payload.valueRange?WebInspector.TextRange.fromObject(payload.valueRange):null;this._computedLength=payload.computedLength||null;}
  2177. WebInspector.CSSMediaQueryExpression.parsePayload=function(payload)
  2178. {return new WebInspector.CSSMediaQueryExpression(payload);}
  2179. WebInspector.CSSMediaQueryExpression.prototype={value:function()
  2180. {return this._value;},unit:function()
  2181. {return this._unit;},feature:function()
  2182. {return this._feature;},valueRange:function()
  2183. {return this._valueRange;},computedLength:function()
  2184. {return this._computedLength;}}
  2185. WebInspector.CSSMedia=function(cssModel,payload)
  2186. {this._cssModel=cssModel;this.text=payload.text;this.source=payload.source;this.sourceURL=payload.sourceURL||"";this.range=payload.range?WebInspector.TextRange.fromObject(payload.range):null;this.parentStyleSheetId=payload.parentStyleSheetId;this.mediaList=null;if(payload.mediaList){this.mediaList=[];for(var i=0;i<payload.mediaList.length;++i)
  2187. this.mediaList.push(WebInspector.CSSMediaQuery.parsePayload(payload.mediaList[i]));}}
  2188. WebInspector.CSSMedia.Source={LINKED_SHEET:"linkedSheet",INLINE_SHEET:"inlineSheet",MEDIA_RULE:"mediaRule",IMPORT_RULE:"importRule"};WebInspector.CSSMedia.parsePayload=function(cssModel,payload)
  2189. {return new WebInspector.CSSMedia(cssModel,payload);}
  2190. WebInspector.CSSMedia.parseMediaArrayPayload=function(cssModel,payload)
  2191. {var result=[];for(var i=0;i<payload.length;++i)
  2192. result.push(WebInspector.CSSMedia.parsePayload(cssModel,payload[i]));return result;}
  2193. WebInspector.CSSMedia.prototype={sourceStyleSheetEdited:function(styleSheetId,oldRange,newRange)
  2194. {if(this.parentStyleSheetId!==styleSheetId)
  2195. return;if(this.range)
  2196. this.range=this.range.rebaseAfterTextEdit(oldRange,newRange);},equal:function(other)
  2197. {if(!this.parentStyleSheetId||!this.range||!other.range)
  2198. return false;return this.parentStyleSheetId===other.parentStyleSheetId&&this.range.equal(other.range);},active:function()
  2199. {if(!this.mediaList)
  2200. return true;for(var i=0;i<this.mediaList.length;++i){if(this.mediaList[i].active())
  2201. return true;}
  2202. return false;},lineNumberInSource:function()
  2203. {if(!this.range)
  2204. return undefined;var header=this.header();if(!header)
  2205. return undefined;return header.lineNumberInSource(this.range.startLine);},columnNumberInSource:function()
  2206. {if(!this.range)
  2207. return undefined;var header=this.header();if(!header)
  2208. return undefined;return header.columnNumberInSource(this.range.startLine,this.range.startColumn);},header:function()
  2209. {return this.parentStyleSheetId?this._cssModel.styleSheetHeaderForId(this.parentStyleSheetId):null;},rawLocation:function()
  2210. {if(!this.header()||this.lineNumberInSource()===undefined)
  2211. return null;var lineNumber=Number(this.lineNumberInSource());return new WebInspector.CSSLocation(this._cssModel.target(),this.header().id,this.sourceURL,lineNumber,this.columnNumberInSource());}}
  2212. WebInspector.CSSStyleSheetHeader=function(cssModel,payload)
  2213. {this._cssModel=cssModel;this.id=payload.styleSheetId;this.frameId=payload.frameId;this.sourceURL=payload.sourceURL;this.hasSourceURL=!!payload.hasSourceURL;this.sourceMapURL=payload.sourceMapURL;this.origin=payload.origin;this.title=payload.title;this.disabled=payload.disabled;this.isInline=payload.isInline;this.startLine=payload.startLine;this.startColumn=payload.startColumn;if(payload.ownerNode)
  2214. this.ownerNode=new WebInspector.DeferredDOMNode(cssModel.target(),payload.ownerNode);}
  2215. WebInspector.CSSStyleSheetHeader.prototype={target:function()
  2216. {return this._cssModel.target();},resourceURL:function()
  2217. {return this.isViaInspector()?this._viaInspectorResourceURL():this.sourceURL;},_viaInspectorResourceURL:function()
  2218. {var frame=this._cssModel.target().resourceTreeModel.frameForId(this.frameId);console.assert(frame);var parsedURL=new WebInspector.ParsedURL(frame.url);var fakeURL="inspector://"+parsedURL.host+parsedURL.folderPathComponents;if(!fakeURL.endsWith("/"))
  2219. fakeURL+="/";fakeURL+="inspector-stylesheet";return fakeURL;},lineNumberInSource:function(lineNumberInStyleSheet)
  2220. {return this.startLine+lineNumberInStyleSheet;},columnNumberInSource:function(lineNumberInStyleSheet,columnNumberInStyleSheet)
  2221. {return(lineNumberInStyleSheet?0:this.startColumn)+columnNumberInStyleSheet;},contentURL:function()
  2222. {return this.resourceURL();},contentType:function()
  2223. {return WebInspector.resourceTypes.Stylesheet;},_trimSourceURL:function(text)
  2224. {var sourceURLRegex=/\n[\040\t]*\/\*[#@][\040\t]sourceURL=[\040\t]*([^\s]*)[\040\t]*\*\/[\040\t]*$/mg;return text.replace(sourceURLRegex,"");},requestContent:function(callback)
  2225. {this._cssModel._agent.getStyleSheetText(this.id,textCallback.bind(this));function textCallback(error,text)
  2226. {if(error){WebInspector.console.error("Failed to get text for stylesheet "+this.id+": "+error);text="";}
  2227. text=this._trimSourceURL(text);callback(text);}},searchInContent:function(query,caseSensitive,isRegex,callback)
  2228. {function performSearch(content)
  2229. {callback(WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex));}
  2230. this.requestContent(performSearch);},setContent:function(newText,callback)
  2231. {newText=this._trimSourceURL(newText);if(this.hasSourceURL)
  2232. newText+="\n/*# sourceURL="+this.sourceURL+" */";this._cssModel._agent.setStyleSheetText(this.id,newText,callback);},isViaInspector:function()
  2233. {return this.origin==="inspector";}}
  2234. WebInspector.CSSDispatcher=function(cssModel)
  2235. {this._cssModel=cssModel;}
  2236. WebInspector.CSSDispatcher.prototype={mediaQueryResultChanged:function()
  2237. {this._cssModel.mediaQueryResultChanged();},styleSheetChanged:function(styleSheetId)
  2238. {this._cssModel._fireStyleSheetChanged(styleSheetId);},styleSheetAdded:function(header)
  2239. {this._cssModel._styleSheetAdded(header);},styleSheetRemoved:function(id)
  2240. {this._cssModel._styleSheetRemoved(id);},}
  2241. WebInspector.CSSStyleModel.ComputedStyleLoader=function(cssModel)
  2242. {this._cssModel=cssModel;this._nodeIdToCallbackData={};}
  2243. WebInspector.CSSStyleModel.ComputedStyleLoader.prototype={getComputedStyle:function(nodeId,userCallback)
  2244. {if(this._nodeIdToCallbackData[nodeId]){this._nodeIdToCallbackData[nodeId].push(userCallback);return;}
  2245. this._nodeIdToCallbackData[nodeId]=[userCallback];this._cssModel._agent.getComputedStyleForNode(nodeId,resultCallback.bind(this,nodeId));function resultCallback(nodeId,error,computedPayload)
  2246. {var computedStyle=(error||!computedPayload)?null:WebInspector.CSSStyleDeclaration.parseComputedStylePayload(this._cssModel,computedPayload);var callbacks=this._nodeIdToCallbackData[nodeId];if(!callbacks)
  2247. return;delete this._nodeIdToCallbackData[nodeId];for(var i=0;i<callbacks.length;++i)
  2248. callbacks[i](computedStyle);}}}
  2249. WebInspector.cssModel;;WebInspector.DOMNode=function(domModel,doc,isInShadowTree,payload){WebInspector.SDKObject.call(this,domModel.target());this._domModel=domModel;this._agent=domModel._agent;this.ownerDocument=doc;this._isInShadowTree=isInShadowTree;this.id=payload.nodeId;domModel._idToDOMNode[this.id]=this;this._nodeType=payload.nodeType;this._nodeName=payload.nodeName;this._localName=payload.localName;this._nodeValue=payload.nodeValue;this._pseudoType=payload.pseudoType;this._shadowRootType=payload.shadowRootType;this._frameId=payload.frameId||null;this._shadowRoots=[];this._attributes=[];this._attributesMap={};if(payload.attributes)
  2250. this._setAttributesPayload(payload.attributes);this._userProperties={};this._descendantUserPropertyCounters={};this._childNodeCount=payload.childNodeCount||0;this._children=null;this.nextSibling=null;this.previousSibling=null;this.firstChild=null;this.lastChild=null;this.parentNode=null;if(payload.shadowRoots){for(var i=0;i<payload.shadowRoots.length;++i){var root=payload.shadowRoots[i];var node=new WebInspector.DOMNode(this._domModel,this.ownerDocument,true,root);this._shadowRoots.push(node);node.parentNode=this;}}
  2251. if(payload.templateContent){this._templateContent=new WebInspector.DOMNode(this._domModel,this.ownerDocument,true,payload.templateContent);this._templateContent.parentNode=this;}
  2252. if(payload.importedDocument){this._importedDocument=new WebInspector.DOMNode(this._domModel,this.ownerDocument,true,payload.importedDocument);this._importedDocument.parentNode=this;}
  2253. if(payload.children)
  2254. this._setChildrenPayload(payload.children);this._setPseudoElements(payload.pseudoElements);if(payload.contentDocument){this._contentDocument=new WebInspector.DOMDocument(domModel,payload.contentDocument);this._children=[this._contentDocument];this._renumber();}
  2255. if(this._nodeType===Node.ELEMENT_NODE){if(this.ownerDocument&&!this.ownerDocument.documentElement&&this._nodeName==="HTML")
  2256. this.ownerDocument.documentElement=this;if(this.ownerDocument&&!this.ownerDocument.body&&this._nodeName==="BODY")
  2257. this.ownerDocument.body=this;}else if(this._nodeType===Node.DOCUMENT_TYPE_NODE){this.publicId=payload.publicId;this.systemId=payload.systemId;this.internalSubset=payload.internalSubset;}else if(this._nodeType===Node.ATTRIBUTE_NODE){this.name=payload.name;this.value=payload.value;}}
  2258. WebInspector.DOMNode.PseudoElementNames={Before:"before",After:"after"}
  2259. WebInspector.DOMNode.ShadowRootTypes={UserAgent:"user-agent",Author:"author"}
  2260. WebInspector.DOMNode.prototype={domModel:function()
  2261. {return this._domModel;},children:function()
  2262. {return this._children?this._children.slice():null;},hasAttributes:function()
  2263. {return this._attributes.length>0;},childNodeCount:function()
  2264. {return this._childNodeCount;},hasShadowRoots:function()
  2265. {return!!this._shadowRoots.length;},shadowRoots:function()
  2266. {return this._shadowRoots.slice();},templateContent:function()
  2267. {return this._templateContent||null;},importedDocument:function()
  2268. {return this._importedDocument||null;},nodeType:function()
  2269. {return this._nodeType;},nodeName:function()
  2270. {return this._nodeName;},pseudoType:function()
  2271. {return this._pseudoType;},hasPseudoElements:function()
  2272. {return this._pseudoElements.size>0;},pseudoElements:function()
  2273. {return this._pseudoElements;},beforePseudoElement:function()
  2274. {if(!this._pseudoElements)
  2275. return null;return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementNames.Before);},afterPseudoElement:function()
  2276. {if(!this._pseudoElements)
  2277. return null;return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementNames.After);},isInsertionPoint:function()
  2278. {return!this.isXMLNode()&&(this._nodeName==="SHADOW"||this._nodeName==="CONTENT");},distributedNodes:function()
  2279. {return this._distributedNodes||[];},insertionPoints:function()
  2280. {return this._insertionPoints||[];},distributedShadowRoot:function()
  2281. {return this._distributedShadowRoot;},isInShadowTree:function()
  2282. {return this._isInShadowTree;},ancestorShadowHost:function()
  2283. {var ancestorShadowRoot=this.ancestorShadowRoot();return ancestorShadowRoot?ancestorShadowRoot.parentNode:null;},ancestorShadowRoot:function()
  2284. {if(!this._isInShadowTree)
  2285. return null;var current=this;while(current&&!current.isShadowRoot())
  2286. current=current.parentNode;return current;},ancestorUserAgentShadowRoot:function()
  2287. {var ancestorShadowRoot=this.ancestorShadowRoot();if(!ancestorShadowRoot)
  2288. return null;return ancestorShadowRoot.shadowRootType()===WebInspector.DOMNode.ShadowRootTypes.UserAgent?ancestorShadowRoot:null;},isShadowRoot:function()
  2289. {return!!this._shadowRootType;},shadowRootType:function()
  2290. {return this._shadowRootType||null;},nodeNameInCorrectCase:function()
  2291. {var shadowRootType=this.shadowRootType();if(shadowRootType)
  2292. return"#shadow-root"+(shadowRootType===WebInspector.DOMNode.ShadowRootTypes.UserAgent?" (user-agent)":"");return this.isXMLNode()?this.nodeName():this.nodeName().toLowerCase();},setNodeName:function(name,callback)
  2293. {this._agent.setNodeName(this.id,name,this._domModel._markRevision(this,callback));},localName:function()
  2294. {return this._localName;},nodeValue:function()
  2295. {return this._nodeValue;},setNodeValue:function(value,callback)
  2296. {this._agent.setNodeValue(this.id,value,this._domModel._markRevision(this,callback));},getAttribute:function(name)
  2297. {var attr=this._attributesMap[name];return attr?attr.value:undefined;},setAttribute:function(name,text,callback)
  2298. {this._agent.setAttributesAsText(this.id,text,name,this._domModel._markRevision(this,callback));},setAttributeValue:function(name,value,callback)
  2299. {this._agent.setAttributeValue(this.id,name,value,this._domModel._markRevision(this,callback));},attributes:function()
  2300. {return this._attributes;},removeAttribute:function(name,callback)
  2301. {function mycallback(error)
  2302. {if(!error){delete this._attributesMap[name];for(var i=0;i<this._attributes.length;++i){if(this._attributes[i].name===name){this._attributes.splice(i,1);break;}}}
  2303. this._domModel._markRevision(this,callback)(error);}
  2304. this._agent.removeAttribute(this.id,name,mycallback.bind(this));},ensureShadowHostDistributedNodesLoaded:function(callback)
  2305. {if(this.hasShadowRoots()&&!this._distributedNodesLoaded){this._requestShadowHostDistribution(innerCallback.bind(this));return;}
  2306. function innerCallback()
  2307. {this._distributedNodesLoaded=true;callback();}
  2308. callback();},_requestShadowHostDistribution:function(callback)
  2309. {this._agent.requestShadowHostDistributedNodes(this.id,innerCallback.bind(this));function innerCallback(error,insertionPointDistributions)
  2310. {if(error)
  2311. console.error(error);this._setShadowHostDistribution(insertionPointDistributions);callback();}},_setShadowHostDistribution:function(insertionPointDistributions)
  2312. {this._nodeDistributionPaths=new WeakMap();this._insertionPoints=[];for(var insertionPointDistribution of insertionPointDistributions){var insertionPointId=insertionPointDistribution.nodeId;var insertionPoint=this._domModel.nodeForId(insertionPointId)
  2313. if(!insertionPoint)
  2314. return;this._insertionPoints.push(insertionPoint);if(insertionPoint._nodeName==="SHADOW"){var ancestorShadowRoot=insertionPoint.ancestorShadowRoot();var ancestorShadowHost=ancestorShadowRoot.parentNode;var shadowRootIndex=ancestorShadowHost._shadowRoots.indexOf(ancestorShadowRoot);if(shadowRootIndex+1<ancestorShadowHost._shadowRoots.length)
  2315. insertionPoint._distributedShadowRoot=ancestorShadowHost._shadowRoots[shadowRootIndex+1];}else{var distributedNodes=insertionPointDistribution.distributedNodes;insertionPoint._distributedNodes=[];var addedNodes=new Set();for(var distributedNodeObject of distributedNodes){var distributedNodeId=distributedNodeObject.nodeId;var destinationInsertionPointIds=distributedNodeObject.destinationInsertionPointIds||[insertionPointId];var distributedNode=this._domModel.nodeForId(distributedNodeId);var destinationInsertionPoints=destinationInsertionPointIds.map(this._domModel.nodeForId.bind(this._domModel))
  2316. this._nodeDistributionPaths.set(distributedNode,destinationInsertionPoints);var insertionPointIndex=destinationInsertionPoints.indexOf(insertionPoint);var redistributedInsertionPoint;if(insertionPointIndex>0)
  2317. redistributedInsertionPoint=destinationInsertionPoints[insertionPointIndex-1];var nodeToAdd=redistributedInsertionPoint||distributedNode;if(!addedNodes.has(nodeToAdd)){insertionPoint._distributedNodes.push(redistributedInsertionPoint||distributedNode);addedNodes.add(nodeToAdd);}}}}},getChildNodes:function(callback)
  2318. {if(this._children){if(callback)
  2319. callback(this.children());return;}
  2320. function mycallback(error)
  2321. {if(callback)
  2322. callback(error?null:this.children());}
  2323. this._agent.requestChildNodes(this.id,undefined,mycallback.bind(this));},getSubtree:function(depth,callback)
  2324. {function mycallback(error)
  2325. {if(callback)
  2326. callback(error?null:this._children);}
  2327. this._agent.requestChildNodes(this.id,depth,mycallback.bind(this));},getOuterHTML:function(callback)
  2328. {this._agent.getOuterHTML(this.id,callback);},setOuterHTML:function(html,callback)
  2329. {this._agent.setOuterHTML(this.id,html,this._domModel._markRevision(this,callback));},removeNode:function(callback)
  2330. {this._agent.removeNode(this.id,this._domModel._markRevision(this,callback));},copyNode:function(callback)
  2331. {function copy(error,text)
  2332. {if(!error)
  2333. InspectorFrontendHost.copyText(text);if(callback)
  2334. callback(error?null:text);}
  2335. this._agent.getOuterHTML(this.id,copy);},eventListeners:function(objectGroupId,callback)
  2336. {var target=this.target();function mycallback(error,payloads)
  2337. {if(error){callback(null);return;}
  2338. callback(payloads.map(function(payload){return new WebInspector.DOMModel.EventListener(target,payload);}));}
  2339. this._agent.getEventListenersForNode(this.id,objectGroupId,mycallback);},path:function()
  2340. {function canPush(node)
  2341. {return node&&("index"in node||(node.isShadowRoot()&&node.parentNode))&&node._nodeName.length;}
  2342. var path=[];var node=this;while(canPush(node)){var index=typeof node.index==="number"?node.index:(node.shadowRootType()===WebInspector.DOMNode.ShadowRootTypes.UserAgent?"u":"a");path.push([index,node._nodeName]);node=node.parentNode;}
  2343. path.reverse();return path.join(",");},isAncestor:function(node)
  2344. {if(!node)
  2345. return false;var currentNode=node.parentNode;while(currentNode){if(this===currentNode)
  2346. return true;currentNode=currentNode.parentNode;}
  2347. return false;},isDescendant:function(descendant)
  2348. {return descendant!==null&&descendant.isAncestor(this);},frameId:function()
  2349. {var node=this;while(!node._frameId&&node.parentNode)
  2350. node=node.parentNode;return node._frameId;},_setAttributesPayload:function(attrs)
  2351. {var attributesChanged=!this._attributes||attrs.length!==this._attributes.length*2;var oldAttributesMap=this._attributesMap||{};this._attributes=[];this._attributesMap={};for(var i=0;i<attrs.length;i+=2){var name=attrs[i];var value=attrs[i+1];this._addAttribute(name,value);if(attributesChanged)
  2352. continue;if(!oldAttributesMap[name]||oldAttributesMap[name].value!==value)
  2353. attributesChanged=true;}
  2354. return attributesChanged;},_insertChild:function(prev,payload)
  2355. {var node=new WebInspector.DOMNode(this._domModel,this.ownerDocument,this._isInShadowTree,payload);this._children.splice(this._children.indexOf(prev)+1,0,node);this._renumber();return node;},_removeChild:function(node)
  2356. {if(node.pseudoType()){this._pseudoElements.delete(node.pseudoType());}else{var shadowRootIndex=this._shadowRoots.indexOf(node);if(shadowRootIndex!==-1)
  2357. this._shadowRoots.splice(shadowRootIndex,1);else
  2358. this._children.splice(this._children.indexOf(node),1);}
  2359. node.parentNode=null;node._updateChildUserPropertyCountsOnRemoval(this);this._renumber();},_setChildrenPayload:function(payloads)
  2360. {if(this._contentDocument)
  2361. return;this._children=[];for(var i=0;i<payloads.length;++i){var payload=payloads[i];var node=new WebInspector.DOMNode(this._domModel,this.ownerDocument,this._isInShadowTree,payload);this._children.push(node);}
  2362. this._renumber();},_setPseudoElements:function(payloads)
  2363. {this._pseudoElements=new Map();if(!payloads)
  2364. return;for(var i=0;i<payloads.length;++i){var node=new WebInspector.DOMNode(this._domModel,this.ownerDocument,this._isInShadowTree,payloads[i]);node.parentNode=this;this._pseudoElements.set(node.pseudoType(),node);}},_renumber:function()
  2365. {this._childNodeCount=this._children.length;if(this._childNodeCount==0){this.firstChild=null;this.lastChild=null;return;}
  2366. this.firstChild=this._children[0];this.lastChild=this._children[this._childNodeCount-1];for(var i=0;i<this._childNodeCount;++i){var child=this._children[i];child.index=i;child.nextSibling=i+1<this._childNodeCount?this._children[i+1]:null;child.previousSibling=i-1>=0?this._children[i-1]:null;child.parentNode=this;}},_addAttribute:function(name,value)
  2367. {var attr={name:name,value:value,_node:this};this._attributesMap[name]=attr;this._attributes.push(attr);},_setAttribute:function(name,value)
  2368. {var attr=this._attributesMap[name];if(attr)
  2369. attr.value=value;else
  2370. this._addAttribute(name,value);},_removeAttribute:function(name)
  2371. {var attr=this._attributesMap[name];if(attr){this._attributes.remove(attr);delete this._attributesMap[name];}},copyTo:function(targetNode,anchorNode,callback)
  2372. {this._agent.copyTo(this.id,targetNode.id,anchorNode?anchorNode.id:undefined,this._domModel._markRevision(this,callback));},moveTo:function(targetNode,anchorNode,callback)
  2373. {this._agent.moveTo(this.id,targetNode.id,anchorNode?anchorNode.id:undefined,this._domModel._markRevision(this,callback));},isXMLNode:function()
  2374. {return!!this.ownerDocument&&!!this.ownerDocument.xmlVersion;},_updateChildUserPropertyCountsOnRemoval:function(parentNode)
  2375. {var result={};if(this._userProperties){for(var name in this._userProperties)
  2376. result[name]=(result[name]||0)+1;}
  2377. if(this._descendantUserPropertyCounters){for(var name in this._descendantUserPropertyCounters){var counter=this._descendantUserPropertyCounters[name];result[name]=(result[name]||0)+counter;}}
  2378. for(var name in result)
  2379. parentNode._updateDescendantUserPropertyCount(name,-result[name]);},_updateDescendantUserPropertyCount:function(name,delta)
  2380. {if(!this._descendantUserPropertyCounters.hasOwnProperty(name))
  2381. this._descendantUserPropertyCounters[name]=0;this._descendantUserPropertyCounters[name]+=delta;if(!this._descendantUserPropertyCounters[name])
  2382. delete this._descendantUserPropertyCounters[name];if(this.parentNode)
  2383. this.parentNode._updateDescendantUserPropertyCount(name,delta);},setUserProperty:function(name,value)
  2384. {if(value===null){this.removeUserProperty(name);return;}
  2385. if(this.parentNode&&!this._userProperties.hasOwnProperty(name))
  2386. this.parentNode._updateDescendantUserPropertyCount(name,1);this._userProperties[name]=value;},removeUserProperty:function(name)
  2387. {if(!this._userProperties.hasOwnProperty(name))
  2388. return;delete this._userProperties[name];if(this.parentNode)
  2389. this.parentNode._updateDescendantUserPropertyCount(name,-1);},getUserProperty:function(name)
  2390. {return(this._userProperties&&this._userProperties[name])||null;},descendantUserPropertyCount:function(name)
  2391. {return this._descendantUserPropertyCounters&&this._descendantUserPropertyCounters[name]?this._descendantUserPropertyCounters[name]:0;},resolveURL:function(url)
  2392. {if(!url)
  2393. return url;for(var frameOwnerCandidate=this;frameOwnerCandidate;frameOwnerCandidate=frameOwnerCandidate.parentNode){if(frameOwnerCandidate.baseURL)
  2394. return WebInspector.ParsedURL.completeURL(frameOwnerCandidate.baseURL,url);}
  2395. return null;},highlight:function(mode,objectId)
  2396. {this._domModel.highlightDOMNode(this.id,mode,objectId);},highlightForTwoSeconds:function()
  2397. {this._domModel.highlightDOMNodeForTwoSeconds(this.id);},resolveToObject:function(objectGroup,callback)
  2398. {this._agent.resolveNode(this.id,objectGroup,mycallback.bind(this));function mycallback(error,object)
  2399. {if(!callback)
  2400. return;if(error||!object)
  2401. callback(null);else
  2402. callback(this.target().runtimeModel.createRemoteObject(object));}},boxModel:function(callback)
  2403. {this._agent.getBoxModel(this.id,this._domModel._wrapClientCallback(callback));},__proto__:WebInspector.SDKObject.prototype}
  2404. WebInspector.DeferredDOMNode=function(target,backendNodeId)
  2405. {this._target=target;this._backendNodeId=backendNodeId;}
  2406. WebInspector.DeferredDOMNode.prototype={resolve:function(callback)
  2407. {this._target.domModel.pushNodesByBackendIdsToFrontend([this._backendNodeId],onGotNode.bind(this));function onGotNode(nodeIds)
  2408. {if(!nodeIds||!nodeIds[0]){callback(null);return;}
  2409. callback(this._target.domModel.nodeForId(nodeIds[0]));}}}
  2410. WebInspector.DOMDocument=function(domModel,payload)
  2411. {WebInspector.DOMNode.call(this,domModel,this,false,payload);this.documentURL=payload.documentURL||"";this.baseURL=payload.baseURL||"";this.xmlVersion=payload.xmlVersion;this._listeners={};}
  2412. WebInspector.DOMDocument.prototype={__proto__:WebInspector.DOMNode.prototype}
  2413. WebInspector.DOMModel=function(target){WebInspector.SDKModel.call(this,WebInspector.DOMModel,target);this._agent=target.domAgent();this._idToDOMNode={};this._document=null;this._attributeLoadNodeIds={};this._shadowHostDistributionRequestNodeIds=new Set();target.registerDOMDispatcher(new WebInspector.DOMDispatcher(this));this._defaultHighlighter=new WebInspector.DefaultDOMNodeHighlighter(this._agent);this._highlighter=this._defaultHighlighter;this._agent.enable();}
  2414. WebInspector.DOMModel.Events={AttrModified:"AttrModified",AttrRemoved:"AttrRemoved",CharacterDataModified:"CharacterDataModified",NodeInserted:"NodeInserted",NodeInspected:"NodeInspected",NodeRemoved:"NodeRemoved",DocumentUpdated:"DocumentUpdated",ChildNodeCountUpdated:"ChildNodeCountUpdated",UndoRedoRequested:"UndoRedoRequested",UndoRedoCompleted:"UndoRedoCompleted",DistributedNodesChanged:"DistributedNodesChanged",}
  2415. WebInspector.DOMModel.prototype={suspendModel:function()
  2416. {this._agent.disable();},resumeModel:function()
  2417. {this._agent.enable();},requestDocument:function(callback)
  2418. {if(this._document){if(callback)
  2419. callback(this._document);return;}
  2420. if(this._pendingDocumentRequestCallbacks){this._pendingDocumentRequestCallbacks.push(callback);return;}
  2421. this._pendingDocumentRequestCallbacks=[callback];function onDocumentAvailable(error,root)
  2422. {if(!error)
  2423. this._setDocument(root);for(var i=0;i<this._pendingDocumentRequestCallbacks.length;++i){var callback=this._pendingDocumentRequestCallbacks[i];if(callback)
  2424. callback(this._document);}
  2425. delete this._pendingDocumentRequestCallbacks;}
  2426. this._agent.getDocument(onDocumentAvailable.bind(this));},existingDocument:function()
  2427. {return this._document;},pushNodeToFrontend:function(objectId,callback)
  2428. {function mycallback(nodeId)
  2429. {callback(nodeId?this.nodeForId(nodeId):null);}
  2430. this._dispatchWhenDocumentAvailable(this._agent.requestNode.bind(this._agent,objectId),mycallback.bind(this));},pushNodeByPathToFrontend:function(path,callback)
  2431. {this._dispatchWhenDocumentAvailable(this._agent.pushNodeByPathToFrontend.bind(this._agent,path),callback);},pushNodesByBackendIdsToFrontend:function(backendNodeIds,callback)
  2432. {this._dispatchWhenDocumentAvailable(this._agent.pushNodesByBackendIdsToFrontend.bind(this._agent,backendNodeIds),callback);},_wrapClientCallback:function(callback)
  2433. {if(!callback)
  2434. return;var wrapper=function(error,result)
  2435. {callback(error?null:result);};return wrapper;},_dispatchWhenDocumentAvailable:function(func,callback)
  2436. {var callbackWrapper=this._wrapClientCallback(callback);function onDocumentAvailable()
  2437. {if(this._document)
  2438. func(callbackWrapper);else{if(callbackWrapper)
  2439. callbackWrapper("No document");}}
  2440. this.requestDocument(onDocumentAvailable.bind(this));},_attributeModified:function(nodeId,name,value)
  2441. {var node=this._idToDOMNode[nodeId];if(!node)
  2442. return;node._setAttribute(name,value);this.dispatchEventToListeners(WebInspector.DOMModel.Events.AttrModified,{node:node,name:name});},_attributeRemoved:function(nodeId,name)
  2443. {var node=this._idToDOMNode[nodeId];if(!node)
  2444. return;node._removeAttribute(name);this.dispatchEventToListeners(WebInspector.DOMModel.Events.AttrRemoved,{node:node,name:name});},_inlineStyleInvalidated:function(nodeIds)
  2445. {for(var i=0;i<nodeIds.length;++i)
  2446. this._attributeLoadNodeIds[nodeIds[i]]=true;if("_loadNodeAttributesTimeout"in this)
  2447. return;this._loadNodeAttributesTimeout=setTimeout(this._loadNodeAttributes.bind(this),20);},_loadNodeAttributes:function()
  2448. {function callback(nodeId,error,attributes)
  2449. {if(error){return;}
  2450. var node=this._idToDOMNode[nodeId];if(node){if(node._setAttributesPayload(attributes))
  2451. this.dispatchEventToListeners(WebInspector.DOMModel.Events.AttrModified,{node:node,name:"style"});}}
  2452. delete this._loadNodeAttributesTimeout;for(var nodeId in this._attributeLoadNodeIds){var nodeIdAsNumber=parseInt(nodeId,10);this._agent.getAttributes(nodeIdAsNumber,callback.bind(this,nodeIdAsNumber));}
  2453. this._attributeLoadNodeIds={};},_shadowHostDistributionInvalidated:function(nodeIds)
  2454. {if(!this._shadowHostDistributionRequestThrottler)
  2455. this._shadowHostDistributionRequestThrottler=new WebInspector.Throttler(20);this._shadowHostDistributionRequestThrottler.schedule(this._requestShadowHostDistributions.bind(this));for(var nodeId of nodeIds)
  2456. this._shadowHostDistributionRequestNodeIds.add(nodeId);},_requestShadowHostDistributions:function(callback)
  2457. {var barrier=new CallbackBarrier();for(var nodeId of this._shadowHostDistributionRequestNodeIds){var node=this._idToDOMNode[nodeId];var barrierCallback=barrier.createCallback();node._requestShadowHostDistribution(shadowHostDistributionLoaded.bind(this,barrierCallback,node));}
  2458. this._shadowHostDistributionRequestNodeIds.clear();barrier.callWhenDone(callback);function shadowHostDistributionLoaded(barrierCallback,shadowHost)
  2459. {this.dispatchEventToListeners(WebInspector.DOMModel.Events.DistributedNodesChanged,shadowHost);barrierCallback();}},_characterDataModified:function(nodeId,newValue)
  2460. {var node=this._idToDOMNode[nodeId];node._nodeValue=newValue;this.dispatchEventToListeners(WebInspector.DOMModel.Events.CharacterDataModified,node);},nodeForId:function(nodeId)
  2461. {return this._idToDOMNode[nodeId]||null;},_documentUpdated:function()
  2462. {this._setDocument(null);},_setDocument:function(payload)
  2463. {this._idToDOMNode={};if(payload&&"nodeId"in payload)
  2464. this._document=new WebInspector.DOMDocument(this,payload);else
  2465. this._document=null;this.dispatchEventToListeners(WebInspector.DOMModel.Events.DocumentUpdated,this._document);},_setDetachedRoot:function(payload)
  2466. {if(payload.nodeName==="#document")
  2467. new WebInspector.DOMDocument(this,payload);else
  2468. new WebInspector.DOMNode(this,null,false,payload);},_setChildNodes:function(parentId,payloads)
  2469. {if(!parentId&&payloads.length){this._setDetachedRoot(payloads[0]);return;}
  2470. var parent=this._idToDOMNode[parentId];parent._setChildrenPayload(payloads);},_childNodeCountUpdated:function(nodeId,newValue)
  2471. {var node=this._idToDOMNode[nodeId];node._childNodeCount=newValue;this.dispatchEventToListeners(WebInspector.DOMModel.Events.ChildNodeCountUpdated,node);},_childNodeInserted:function(parentId,prevId,payload)
  2472. {var parent=this._idToDOMNode[parentId];var prev=this._idToDOMNode[prevId];var node=parent._insertChild(prev,payload);this._idToDOMNode[node.id]=node;this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeInserted,node);},_childNodeRemoved:function(parentId,nodeId)
  2473. {var parent=this._idToDOMNode[parentId];var node=this._idToDOMNode[nodeId];parent._removeChild(node);this._unbind(node);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeRemoved,{node:node,parent:parent});},_shadowRootPushed:function(hostId,root)
  2474. {var host=this._idToDOMNode[hostId];if(!host)
  2475. return;var node=new WebInspector.DOMNode(this,host.ownerDocument,true,root);node.parentNode=host;this._idToDOMNode[node.id]=node;host._shadowRoots.unshift(node);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeInserted,node);},_shadowRootPopped:function(hostId,rootId)
  2476. {var host=this._idToDOMNode[hostId];if(!host)
  2477. return;var root=this._idToDOMNode[rootId];if(!root)
  2478. return;host._removeChild(root);this._unbind(root);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeRemoved,{node:root,parent:host});},_pseudoElementAdded:function(parentId,pseudoElement)
  2479. {var parent=this._idToDOMNode[parentId];if(!parent)
  2480. return;var node=new WebInspector.DOMNode(this,parent.ownerDocument,false,pseudoElement);node.parentNode=parent;this._idToDOMNode[node.id]=node;console.assert(!parent._pseudoElements.get(node.pseudoType()));parent._pseudoElements.set(node.pseudoType(),node);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeInserted,node);},_pseudoElementRemoved:function(parentId,pseudoElementId)
  2481. {var parent=this._idToDOMNode[parentId];if(!parent)
  2482. return;var pseudoElement=this._idToDOMNode[pseudoElementId];if(!pseudoElement)
  2483. return;parent._removeChild(pseudoElement);this._unbind(pseudoElement);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeRemoved,{node:pseudoElement,parent:parent});},_unbind:function(node)
  2484. {delete this._idToDOMNode[node.id];for(var i=0;node._children&&i<node._children.length;++i)
  2485. this._unbind(node._children[i]);for(var i=0;i<node._shadowRoots.length;++i)
  2486. this._unbind(node._shadowRoots[i]);var pseudoElements=node.pseudoElements();for(var pseudoType of pseudoElements.keys())
  2487. this._unbind(pseudoElements.get(pseudoType));if(node._templateContent)
  2488. this._unbind(node._templateContent);},_inspectNodeRequested:function(nodeId)
  2489. {this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeInspected,this.nodeForId(nodeId));},performSearch:function(query,includeUserAgentShadowDOM,searchCallback)
  2490. {this.cancelSearch();function callback(error,searchId,resultsCount)
  2491. {this._searchId=searchId;searchCallback(resultsCount);}
  2492. this._agent.performSearch(query,includeUserAgentShadowDOM,callback.bind(this));},performSearchPromise:function(query,includeUserAgentShadowDOM)
  2493. {return new Promise(performSearch.bind(this));function performSearch(resolve)
  2494. {this._agent.performSearch(query,includeUserAgentShadowDOM,callback.bind(this));function callback(error,searchId,resultsCount)
  2495. {if(!error)
  2496. this._searchId=searchId;resolve(error?0:resultsCount);}}},searchResult:function(index,callback)
  2497. {if(this._searchId)
  2498. this._agent.getSearchResults(this._searchId,index,index+1,searchResultsCallback.bind(this));else
  2499. callback(null);function searchResultsCallback(error,nodeIds)
  2500. {if(error){console.error(error);callback(null);return;}
  2501. if(nodeIds.length!=1)
  2502. return;callback(this.nodeForId(nodeIds[0]));}},cancelSearch:function()
  2503. {if(this._searchId){this._agent.discardSearchResults(this._searchId);delete this._searchId;}},querySelector:function(nodeId,selectors,callback)
  2504. {this._agent.querySelector(nodeId,selectors,this._wrapClientCallback(callback));},querySelectorAll:function(nodeId,selectors,callback)
  2505. {this._agent.querySelectorAll(nodeId,selectors,this._wrapClientCallback(callback));},highlightDOMNode:function(nodeId,mode,objectId)
  2506. {this.highlightDOMNodeWithConfig(nodeId,{mode:mode},objectId);},highlightDOMNodeWithConfig:function(nodeId,config,objectId)
  2507. {config=config||{mode:"all",showInfo:undefined};if(this._hideDOMNodeHighlightTimeout){clearTimeout(this._hideDOMNodeHighlightTimeout);delete this._hideDOMNodeHighlightTimeout;}
  2508. var highlightConfig=this._buildHighlightConfig(config.mode);if(typeof config.showInfo!=="undefined")
  2509. highlightConfig.showInfo=config.showInfo;this._highlighter.highlightDOMNode(this.nodeForId(nodeId||0),highlightConfig,objectId);},hideDOMNodeHighlight:function()
  2510. {this.highlightDOMNode(0);},highlightDOMNodeForTwoSeconds:function(nodeId)
  2511. {this.highlightDOMNode(nodeId);this._hideDOMNodeHighlightTimeout=setTimeout(this.hideDOMNodeHighlight.bind(this),2000);},setInspectModeEnabled:function(enabled,inspectUAShadowDOM,callback)
  2512. {function onDocumentAvailable()
  2513. {this._highlighter.setInspectModeEnabled(enabled,inspectUAShadowDOM,this._buildHighlightConfig(),callback);}
  2514. this.requestDocument(onDocumentAvailable.bind(this));},_buildHighlightConfig:function(mode)
  2515. {mode=mode||"all";var highlightConfig={showInfo:mode==="all",showRulers:WebInspector.overridesSupport.showMetricsRulers(),showExtensionLines:WebInspector.overridesSupport.showExtensionLines()};if(mode==="all"||mode==="content")
  2516. highlightConfig.contentColor=WebInspector.Color.PageHighlight.Content.toProtocolRGBA();if(mode==="all"||mode==="padding")
  2517. highlightConfig.paddingColor=WebInspector.Color.PageHighlight.Padding.toProtocolRGBA();if(mode==="all"||mode==="border")
  2518. highlightConfig.borderColor=WebInspector.Color.PageHighlight.Border.toProtocolRGBA();if(mode==="all"||mode==="margin")
  2519. highlightConfig.marginColor=WebInspector.Color.PageHighlight.Margin.toProtocolRGBA();if(mode==="all"){highlightConfig.eventTargetColor=WebInspector.Color.PageHighlight.EventTarget.toProtocolRGBA();highlightConfig.shapeColor=WebInspector.Color.PageHighlight.Shape.toProtocolRGBA();highlightConfig.shapeMarginColor=WebInspector.Color.PageHighlight.ShapeMargin.toProtocolRGBA();}
  2520. return highlightConfig;},_markRevision:function(node,callback)
  2521. {function wrapperFunction(error)
  2522. {if(!error)
  2523. this.markUndoableState();if(callback)
  2524. callback.apply(this,arguments);}
  2525. return wrapperFunction.bind(this);},emulateTouchEventObjects:function(emulationEnabled,configuration)
  2526. {const injectedFunction=function(){const touchEvents=["ontouchstart","ontouchend","ontouchmove","ontouchcancel"];var recepients=[window.__proto__,document.__proto__];for(var i=0;i<touchEvents.length;++i){for(var j=0;j<recepients.length;++j){if(!(touchEvents[i]in recepients[j]))
  2527. Object.defineProperty(recepients[j],touchEvents[i],{value:null,writable:true,configurable:true,enumerable:true});}}}
  2528. if(emulationEnabled&&!this._addTouchEventsScriptInjecting){this._addTouchEventsScriptInjecting=true;PageAgent.addScriptToEvaluateOnLoad("("+injectedFunction.toString()+")()",scriptAddedCallback.bind(this));}else{if(typeof this._addTouchEventsScriptId!=="undefined"){PageAgent.removeScriptToEvaluateOnLoad(this._addTouchEventsScriptId);delete this._addTouchEventsScriptId;}}
  2529. function scriptAddedCallback(error,scriptId)
  2530. {delete this._addTouchEventsScriptInjecting;if(error)
  2531. return;this._addTouchEventsScriptId=scriptId;}
  2532. PageAgent.setTouchEmulationEnabled(emulationEnabled,configuration);},markUndoableState:function()
  2533. {this._agent.markUndoableState();},undo:function(callback)
  2534. {function mycallback(error)
  2535. {this.dispatchEventToListeners(WebInspector.DOMModel.Events.UndoRedoCompleted);callback(error);}
  2536. this.dispatchEventToListeners(WebInspector.DOMModel.Events.UndoRedoRequested);this._agent.undo(callback);},redo:function(callback)
  2537. {function mycallback(error)
  2538. {this.dispatchEventToListeners(WebInspector.DOMModel.Events.UndoRedoCompleted);callback(error);}
  2539. this.dispatchEventToListeners(WebInspector.DOMModel.Events.UndoRedoRequested);this._agent.redo(callback);},setHighlighter:function(highlighter)
  2540. {this._highlighter=highlighter||this._defaultHighlighter;},nodeForLocation:function(x,y,callback)
  2541. {this._agent.getNodeForLocation(x,y,mycallback.bind(this));function mycallback(error,nodeId)
  2542. {if(error){callback(null);return;}
  2543. callback(this.nodeForId(nodeId));}},__proto__:WebInspector.SDKModel.prototype}
  2544. WebInspector.DOMDispatcher=function(domModel)
  2545. {this._domModel=domModel;}
  2546. WebInspector.DOMDispatcher.prototype={documentUpdated:function()
  2547. {this._domModel._documentUpdated();},inspectNodeRequested:function(nodeId)
  2548. {this._domModel._inspectNodeRequested(nodeId);},attributeModified:function(nodeId,name,value)
  2549. {this._domModel._attributeModified(nodeId,name,value);},attributeRemoved:function(nodeId,name)
  2550. {this._domModel._attributeRemoved(nodeId,name);},inlineStyleInvalidated:function(nodeIds)
  2551. {this._domModel._inlineStyleInvalidated(nodeIds);},shadowHostDistributionInvalidated:function(nodeIds)
  2552. {this._domModel._shadowHostDistributionInvalidated(nodeIds);},characterDataModified:function(nodeId,characterData)
  2553. {this._domModel._characterDataModified(nodeId,characterData);},setChildNodes:function(parentId,payloads)
  2554. {this._domModel._setChildNodes(parentId,payloads);},childNodeCountUpdated:function(nodeId,childNodeCount)
  2555. {this._domModel._childNodeCountUpdated(nodeId,childNodeCount);},childNodeInserted:function(parentNodeId,previousNodeId,payload)
  2556. {this._domModel._childNodeInserted(parentNodeId,previousNodeId,payload);},childNodeRemoved:function(parentNodeId,nodeId)
  2557. {this._domModel._childNodeRemoved(parentNodeId,nodeId);},shadowRootPushed:function(hostId,root)
  2558. {this._domModel._shadowRootPushed(hostId,root);},shadowRootPopped:function(hostId,rootId)
  2559. {this._domModel._shadowRootPopped(hostId,rootId);},pseudoElementAdded:function(parentId,pseudoElement)
  2560. {this._domModel._pseudoElementAdded(parentId,pseudoElement);},pseudoElementRemoved:function(parentId,pseudoElementId)
  2561. {this._domModel._pseudoElementRemoved(parentId,pseudoElementId);}}
  2562. WebInspector.DOMModel.EventListener=function(target,payload)
  2563. {WebInspector.SDKObject.call(this,target);this._payload=payload;var sourceName=this._payload.sourceName;if(!sourceName){var script=target.debuggerModel.scriptForId(payload.location.scriptId);sourceName=script?script.contentURL():"";}
  2564. this._sourceName=sourceName;}
  2565. WebInspector.DOMModel.EventListener.prototype={payload:function()
  2566. {return this._payload;},node:function()
  2567. {return this.target().domModel.nodeForId(this._payload.nodeId);},location:function()
  2568. {return WebInspector.DebuggerModel.Location.fromPayload(this.target(),this._payload.location);},handler:function()
  2569. {return this._payload.handler?this.target().runtimeModel.createRemoteObject(this._payload.handler):null;},sourceName:function()
  2570. {return this._sourceName;},__proto__:WebInspector.SDKObject.prototype}
  2571. WebInspector.DOMNodeHighlighter=function(){}
  2572. WebInspector.DOMNodeHighlighter.prototype={highlightDOMNode:function(node,config,objectId){},setInspectModeEnabled:function(enabled,inspectUAShadowDOM,config,callback){}}
  2573. WebInspector.DefaultDOMNodeHighlighter=function(agent)
  2574. {this._agent=agent;}
  2575. WebInspector.DefaultDOMNodeHighlighter.prototype={highlightDOMNode:function(node,config,objectId)
  2576. {if(objectId||node)
  2577. this._agent.highlightNode(config,objectId?undefined:node.id,objectId);else
  2578. this._agent.hideHighlight();},setInspectModeEnabled:function(enabled,inspectUAShadowDOM,config,callback)
  2579. {WebInspector.overridesSupport.setTouchEmulationSuspended(enabled);this._agent.setInspectModeEnabled(enabled,inspectUAShadowDOM,config,callback);}};WebInspector.DOMStorage=function(model,securityOrigin,isLocalStorage)
  2580. {this._model=model;this._securityOrigin=securityOrigin;this._isLocalStorage=isLocalStorage;}
  2581. WebInspector.DOMStorage.storageId=function(securityOrigin,isLocalStorage)
  2582. {return{securityOrigin:securityOrigin,isLocalStorage:isLocalStorage};}
  2583. WebInspector.DOMStorage.Events={DOMStorageItemsCleared:"DOMStorageItemsCleared",DOMStorageItemRemoved:"DOMStorageItemRemoved",DOMStorageItemAdded:"DOMStorageItemAdded",DOMStorageItemUpdated:"DOMStorageItemUpdated"}
  2584. WebInspector.DOMStorage.prototype={get id()
  2585. {return WebInspector.DOMStorage.storageId(this._securityOrigin,this._isLocalStorage);},get securityOrigin()
  2586. {return this._securityOrigin;},get isLocalStorage()
  2587. {return this._isLocalStorage;},getItems:function(callback)
  2588. {this._model._agent.getDOMStorageItems(this.id,callback);},setItem:function(key,value)
  2589. {this._model._agent.setDOMStorageItem(this.id,key,value);},removeItem:function(key)
  2590. {this._model._agent.removeDOMStorageItem(this.id,key);},__proto__:WebInspector.Object.prototype}
  2591. WebInspector.DOMStorageModel=function(target)
  2592. {WebInspector.SDKModel.call(this,WebInspector.DOMStorageModel,target);this._storages={};this._agent=target.domstorageAgent();}
  2593. WebInspector.DOMStorageModel.Events={DOMStorageAdded:"DOMStorageAdded",DOMStorageRemoved:"DOMStorageRemoved"}
  2594. WebInspector.DOMStorageModel.prototype={enable:function()
  2595. {if(this._enabled)
  2596. return;this.target().registerDOMStorageDispatcher(new WebInspector.DOMStorageDispatcher(this));this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);this._agent.enable();var securityOrigins=this.target().resourceTreeModel.securityOrigins();for(var i=0;i<securityOrigins.length;++i)
  2597. this._addOrigin(securityOrigins[i]);this._enabled=true;},_securityOriginAdded:function(event)
  2598. {this._addOrigin((event.data));},_addOrigin:function(securityOrigin)
  2599. {var localStorageKey=this._storageKey(securityOrigin,true);console.assert(!this._storages[localStorageKey]);var localStorage=new WebInspector.DOMStorage(this,securityOrigin,true);this._storages[localStorageKey]=localStorage;this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded,localStorage);var sessionStorageKey=this._storageKey(securityOrigin,false);console.assert(!this._storages[sessionStorageKey]);var sessionStorage=new WebInspector.DOMStorage(this,securityOrigin,false);this._storages[sessionStorageKey]=sessionStorage;this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded,sessionStorage);},_securityOriginRemoved:function(event)
  2600. {var securityOrigin=(event.data);var localStorageKey=this._storageKey(securityOrigin,true);var localStorage=this._storages[localStorageKey];console.assert(localStorage);delete this._storages[localStorageKey];this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved,localStorage);var sessionStorageKey=this._storageKey(securityOrigin,false);var sessionStorage=this._storages[sessionStorageKey];console.assert(sessionStorage);delete this._storages[sessionStorageKey];this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved,sessionStorage);},_storageKey:function(securityOrigin,isLocalStorage)
  2601. {return JSON.stringify(WebInspector.DOMStorage.storageId(securityOrigin,isLocalStorage));},_domStorageItemsCleared:function(storageId)
  2602. {var domStorage=this.storageForId(storageId);if(!domStorage)
  2603. return;var eventData={};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemsCleared,eventData);},_domStorageItemRemoved:function(storageId,key)
  2604. {var domStorage=this.storageForId(storageId);if(!domStorage)
  2605. return;var eventData={key:key};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemRemoved,eventData);},_domStorageItemAdded:function(storageId,key,value)
  2606. {var domStorage=this.storageForId(storageId);if(!domStorage)
  2607. return;var eventData={key:key,value:value};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemAdded,eventData);},_domStorageItemUpdated:function(storageId,key,oldValue,value)
  2608. {var domStorage=this.storageForId(storageId);if(!domStorage)
  2609. return;var eventData={key:key,oldValue:oldValue,value:value};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemUpdated,eventData);},storageForId:function(storageId)
  2610. {return this._storages[JSON.stringify(storageId)];},storages:function()
  2611. {var result=[];for(var id in this._storages)
  2612. result.push(this._storages[id]);return result;},__proto__:WebInspector.SDKModel.prototype}
  2613. WebInspector.DOMStorageDispatcher=function(model)
  2614. {this._model=model;}
  2615. WebInspector.DOMStorageDispatcher.prototype={domStorageItemsCleared:function(storageId)
  2616. {this._model._domStorageItemsCleared(storageId);},domStorageItemRemoved:function(storageId,key)
  2617. {this._model._domStorageItemRemoved(storageId,key);},domStorageItemAdded:function(storageId,key,value)
  2618. {this._model._domStorageItemAdded(storageId,key,value);},domStorageItemUpdated:function(storageId,key,oldValue,value)
  2619. {this._model._domStorageItemUpdated(storageId,key,oldValue,value);},}
  2620. WebInspector.domStorageModel;;WebInspector.Database=function(model,id,domain,name,version)
  2621. {this._model=model;this._id=id;this._domain=domain;this._name=name;this._version=version;}
  2622. WebInspector.Database.prototype={get id()
  2623. {return this._id;},get name()
  2624. {return this._name;},set name(x)
  2625. {this._name=x;},get version()
  2626. {return this._version;},set version(x)
  2627. {this._version=x;},get domain()
  2628. {return this._domain;},set domain(x)
  2629. {this._domain=x;},getTableNames:function(callback)
  2630. {function sortingCallback(error,names)
  2631. {if(!error)
  2632. callback(names.sort());}
  2633. this._model._agent.getDatabaseTableNames(this._id,sortingCallback);},executeSql:function(query,onSuccess,onError)
  2634. {function callback(error,columnNames,values,errorObj)
  2635. {if(error){onError(error);return;}
  2636. if(errorObj){var message;if(errorObj.message)
  2637. message=errorObj.message;else if(errorObj.code==2)
  2638. message=WebInspector.UIString("Database no longer has expected version.");else
  2639. message=WebInspector.UIString("An unexpected error %s occurred.",errorObj.code);onError(message);return;}
  2640. onSuccess(columnNames,values);}
  2641. this._model._agent.executeSQL(this._id,query,callback);}}
  2642. WebInspector.DatabaseModel=function(target)
  2643. {WebInspector.SDKModel.call(this,WebInspector.DatabaseModel,target);this._databases=[];this._agent=target.databaseAgent();}
  2644. WebInspector.DatabaseModel.Events={DatabaseAdded:"DatabaseAdded"}
  2645. WebInspector.DatabaseModel.prototype={enable:function()
  2646. {if(this._enabled)
  2647. return;this.target().registerDatabaseDispatcher(new WebInspector.DatabaseDispatcher(this));this._agent.enable();this._enabled=true;},databases:function()
  2648. {var result=[];for(var databaseId in this._databases)
  2649. result.push(this._databases[databaseId]);return result;},databaseForId:function(databaseId)
  2650. {return this._databases[databaseId];},_addDatabase:function(database)
  2651. {this._databases.push(database);this.dispatchEventToListeners(WebInspector.DatabaseModel.Events.DatabaseAdded,database);},__proto__:WebInspector.SDKModel.prototype}
  2652. WebInspector.DatabaseDispatcher=function(model)
  2653. {this._model=model;}
  2654. WebInspector.DatabaseDispatcher.prototype={addDatabase:function(payload)
  2655. {this._model._addDatabase(new WebInspector.Database(this._model,payload.id,payload.domain,payload.name,payload.version));}}
  2656. WebInspector.databaseModel;;WebInspector.DebuggerModel=function(target)
  2657. {WebInspector.SDKModel.call(this,WebInspector.DebuggerModel,target);target.registerDebuggerDispatcher(new WebInspector.DebuggerDispatcher(this));this._agent=target.debuggerAgent();this._debuggerPausedDetails=null;this._scripts={};this._scriptsBySourceURL=new Map();this._breakpointResolvedEventTarget=new WebInspector.Object();this._isPausing=false;WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseOnExceptionStateChanged,this);WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOnExceptionStateChanged,this);WebInspector.settings.enableAsyncStackTraces.addChangeListener(this.asyncStackTracesStateChanged,this);WebInspector.settings.skipStackFramesPattern.addChangeListener(this._applySkipStackFrameSettings,this);WebInspector.settings.skipContentScripts.addChangeListener(this._applySkipStackFrameSettings,this);WebInspector.settings.disablePausedStateOverlay.addChangeListener(this._updateOverlayMessage,this);this.enableDebugger();this._applySkipStackFrameSettings();}
  2658. WebInspector.DebuggerModel.FunctionDetails;WebInspector.DebuggerModel.GeneratorObjectDetails;WebInspector.DebuggerModel.PauseOnExceptionsState={DontPauseOnExceptions:"none",PauseOnAllExceptions:"all",PauseOnUncaughtExceptions:"uncaught"};WebInspector.DebuggerModel.Events={DebuggerWasEnabled:"DebuggerWasEnabled",DebuggerWasDisabled:"DebuggerWasDisabled",DebuggerPaused:"DebuggerPaused",DebuggerResumed:"DebuggerResumed",ParsedScriptSource:"ParsedScriptSource",FailedToParseScriptSource:"FailedToParseScriptSource",GlobalObjectCleared:"GlobalObjectCleared",CallFrameSelected:"CallFrameSelected",ConsoleCommandEvaluatedInSelectedCallFrame:"ConsoleCommandEvaluatedInSelectedCallFrame",}
  2659. WebInspector.DebuggerModel.BreakReason={DOM:"DOM",EventListener:"EventListener",XHR:"XHR",Exception:"exception",PromiseRejection:"promiseRejection",Assert:"assert",CSPViolation:"CSPViolation",DebugCommand:"debugCommand",Other:"other"}
  2660. WebInspector.DebuggerModel.prototype={debuggerEnabled:function()
  2661. {return!!this._debuggerEnabled;},enableDebugger:function()
  2662. {if(this._debuggerEnabled)
  2663. return;this._agent.enable();this._debuggerEnabled=true;this._pauseOnExceptionStateChanged();this.asyncStackTracesStateChanged();this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasEnabled);},disableDebugger:function()
  2664. {if(!this._debuggerEnabled)
  2665. return;this._agent.disable();this._debuggerEnabled=false;this._isPausing=false;this.asyncStackTracesStateChanged();this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasDisabled);},skipAllPauses:function(skip,untilReload)
  2666. {if(this._skipAllPausesTimeout){clearTimeout(this._skipAllPausesTimeout);delete this._skipAllPausesTimeout;}
  2667. this._agent.setSkipAllPauses(skip,untilReload);},skipAllPausesUntilReloadOrTimeout:function(timeout)
  2668. {if(this._skipAllPausesTimeout)
  2669. clearTimeout(this._skipAllPausesTimeout);this._agent.setSkipAllPauses(true,true);this._skipAllPausesTimeout=setTimeout(this.skipAllPauses.bind(this,false),timeout);},_pauseOnExceptionStateChanged:function()
  2670. {var state;if(!WebInspector.settings.pauseOnExceptionEnabled.get()){state=WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions;}else if(WebInspector.settings.pauseOnCaughtException.get()){state=WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions;}else{state=WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions;}
  2671. this._agent.setPauseOnExceptions(state);},suspendModel:function()
  2672. {this.disableDebugger();},resumeModel:function()
  2673. {this.enableDebugger();},asyncStackTracesStateChanged:function()
  2674. {const maxAsyncStackChainDepth=4;var enabled=WebInspector.settings.enableAsyncStackTraces.get()&&!WebInspector.targetManager.allTargetsSuspended();this._agent.setAsyncCallStackDepth(enabled?maxAsyncStackChainDepth:0);},stepInto:function()
  2675. {function callback()
  2676. {this._agent.stepInto();}
  2677. this._setOverlayMessage(undefined).then(callback.bind(this));},stepIntoAsync:function()
  2678. {function callback()
  2679. {this._agent.stepIntoAsync();}
  2680. this._setOverlayMessage(undefined).then(callback.bind(this));},stepOver:function()
  2681. {function callback()
  2682. {this._agent.stepOver();}
  2683. this._setOverlayMessage(undefined).then(callback.bind(this));},stepOut:function()
  2684. {function callback()
  2685. {this._agent.stepOut();}
  2686. this._setOverlayMessage(undefined).then(callback.bind(this));},resume:function()
  2687. {function callback()
  2688. {this._agent.resume();}
  2689. this._setOverlayMessage(undefined).then(callback.bind(this));this._isPausing=false;},pause:function()
  2690. {this._isPausing=true;this.skipAllPauses(false);this._agent.pause();},setBreakpointByURL:function(url,lineNumber,columnNumber,condition,callback)
  2691. {var minColumnNumber=0;var scripts=this._scriptsBySourceURL.get(url)||[];for(var i=0,l=scripts.length;i<l;++i){var script=scripts[i];if(lineNumber===script.lineOffset)
  2692. minColumnNumber=minColumnNumber?Math.min(minColumnNumber,script.columnOffset):script.columnOffset;}
  2693. columnNumber=Math.max(columnNumber,minColumnNumber);var target=this.target();function didSetBreakpoint(error,breakpointId,locations)
  2694. {if(callback){var rawLocations=locations?locations.map(WebInspector.DebuggerModel.Location.fromPayload.bind(WebInspector.DebuggerModel.Location,target)):[];callback(error?null:breakpointId,rawLocations);}}
  2695. this._agent.setBreakpointByUrl(lineNumber,url,undefined,columnNumber,condition,didSetBreakpoint);WebInspector.userMetrics.ScriptsBreakpointSet.record();},setBreakpointBySourceId:function(rawLocation,condition,callback)
  2696. {var target=this.target();function didSetBreakpoint(error,breakpointId,actualLocation)
  2697. {if(callback){var location=WebInspector.DebuggerModel.Location.fromPayload(target,actualLocation);callback(error?null:breakpointId,[location]);}}
  2698. this._agent.setBreakpoint(rawLocation.payload(),condition,didSetBreakpoint);WebInspector.userMetrics.ScriptsBreakpointSet.record();},removeBreakpoint:function(breakpointId,callback)
  2699. {this._agent.removeBreakpoint(breakpointId,innerCallback);function innerCallback(error)
  2700. {if(error)
  2701. console.error("Failed to remove breakpoint: "+error);if(callback)
  2702. callback();}},_breakpointResolved:function(breakpointId,location)
  2703. {this._breakpointResolvedEventTarget.dispatchEventToListeners(breakpointId,WebInspector.DebuggerModel.Location.fromPayload(this.target(),location));},_globalObjectCleared:function()
  2704. {this._setDebuggerPausedDetails(null);this._reset();this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalObjectCleared);},_reset:function()
  2705. {this._scripts={};this._scriptsBySourceURL.clear();},get scripts()
  2706. {return this._scripts;},scriptForId:function(scriptId)
  2707. {return this._scripts[scriptId]||null;},scriptsForSourceURL:function(sourceURL)
  2708. {if(!sourceURL)
  2709. return[];return this._scriptsBySourceURL.get(sourceURL)||[];},setScriptSource:function(scriptId,newSource,callback)
  2710. {this._scripts[scriptId].editSource(newSource,this._didEditScriptSource.bind(this,scriptId,newSource,callback));},_didEditScriptSource:function(scriptId,newSource,callback,error,errorData,callFrames,asyncStackTrace,needsStepIn)
  2711. {if(needsStepIn){this.stepInto();this._pendingLiveEditCallback=callback.bind(this,error,errorData);return;}
  2712. if(!error&&callFrames&&callFrames.length)
  2713. this._pausedScript(callFrames,this._debuggerPausedDetails.reason,this._debuggerPausedDetails.auxData,this._debuggerPausedDetails.breakpointIds,asyncStackTrace);callback(error,errorData);},get callFrames()
  2714. {return this._debuggerPausedDetails?this._debuggerPausedDetails.callFrames:null;},debuggerPausedDetails:function()
  2715. {return this._debuggerPausedDetails;},_setDebuggerPausedDetails:function(debuggerPausedDetails)
  2716. {this._isPausing=false;this._debuggerPausedDetails=debuggerPausedDetails;if(this._debuggerPausedDetails)
  2717. this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPausedDetails);if(debuggerPausedDetails)
  2718. this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]);else
  2719. this.setSelectedCallFrame(null);this._updateOverlayMessage();},_updateOverlayMessage:function()
  2720. {var message=this._debuggerPausedDetails&&!WebInspector.settings.disablePausedStateOverlay.get()?WebInspector.UIString("Paused in debugger"):undefined;this._setOverlayMessage(message);},_setOverlayMessage:function(message)
  2721. {function setOverlayMessagePromiseCallback(fulfill,reject)
  2722. {var pageAgent=this.target().pageAgent();if(pageAgent)
  2723. pageAgent.setOverlayMessage(message,fulfill);else
  2724. fulfill(undefined);}
  2725. return new Promise(setOverlayMessagePromiseCallback.bind(this));},_pausedScript:function(callFrames,reason,auxData,breakpointIds,asyncStackTrace)
  2726. {this._setDebuggerPausedDetails(new WebInspector.DebuggerPausedDetails(this.target(),callFrames,reason,auxData,breakpointIds,asyncStackTrace));if(this._pendingLiveEditCallback){var callback=this._pendingLiveEditCallback;delete this._pendingLiveEditCallback;callback();}},_resumedScript:function()
  2727. {this._setDebuggerPausedDetails(null);this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerResumed);},_parsedScriptSource:function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL,hasSyntaxError,contextData)
  2728. {var script=new WebInspector.Script(this.target(),scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL,contextData);this._registerScript(script);if(!hasSyntaxError)
  2729. this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource,script);else
  2730. this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.FailedToParseScriptSource,script);},_registerScript:function(script)
  2731. {this._scripts[script.scriptId]=script;if(script.isAnonymousScript())
  2732. return;var scripts=this._scriptsBySourceURL.get(script.sourceURL);if(!scripts){scripts=[];this._scriptsBySourceURL.set(script.sourceURL,scripts);}
  2733. if(scripts.length&&scripts[0].scriptId<script.scriptId)
  2734. scripts.unshift(script);else
  2735. scripts.push(script);},createRawLocation:function(script,lineNumber,columnNumber)
  2736. {if(script.sourceURL)
  2737. return this.createRawLocationByURL(script.sourceURL,lineNumber,columnNumber);return new WebInspector.DebuggerModel.Location(this.target(),script.scriptId,lineNumber,columnNumber);},createRawLocationByURL:function(sourceURL,lineNumber,columnNumber)
  2738. {var closestScript=null;var scripts=this._scriptsBySourceURL.get(sourceURL)||[];for(var i=0,l=scripts.length;i<l;++i){var script=scripts[i];if(!closestScript)
  2739. closestScript=script;if(script.lineOffset>lineNumber||(script.lineOffset===lineNumber&&script.columnOffset>columnNumber))
  2740. continue;if(script.endLine<lineNumber||(script.endLine===lineNumber&&script.endColumn<=columnNumber))
  2741. continue;closestScript=script;break;}
  2742. return closestScript?new WebInspector.DebuggerModel.Location(this.target(),closestScript.scriptId,lineNumber,columnNumber):null;},createRawLocationByScriptId:function(scriptId,sourceUrl,lineNumber,columnNumber)
  2743. {var script=scriptId?this.scriptForId(scriptId):null;return script?this.createRawLocation(script,lineNumber,columnNumber):this.createRawLocationByURL(sourceUrl,lineNumber,columnNumber);},isPaused:function()
  2744. {return!!this.debuggerPausedDetails();},isPausing:function()
  2745. {return this._isPausing;},setSelectedCallFrame:function(callFrame)
  2746. {this._selectedCallFrame=callFrame;if(!this._selectedCallFrame)
  2747. return;this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.CallFrameSelected,callFrame);},selectedCallFrame:function()
  2748. {return this._selectedCallFrame;},evaluateOnSelectedCallFrame:function(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
  2749. {function didEvaluate(result,wasThrown,exceptionDetails)
  2750. {if(!result)
  2751. callback(null,false);else if(returnByValue)
  2752. callback(null,!!wasThrown,wasThrown?null:result,exceptionDetails);else
  2753. callback(this.target().runtimeModel.createRemoteObject(result),!!wasThrown,undefined,exceptionDetails);if(objectGroup==="console")
  2754. this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame);}
  2755. this.selectedCallFrame().evaluate(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,didEvaluate.bind(this));},getSelectedCallFrameVariables:function(callback)
  2756. {var result={this:true};var selectedCallFrame=this._selectedCallFrame;if(!selectedCallFrame)
  2757. callback(result);var pendingRequests=0;function propertiesCollected(properties)
  2758. {for(var i=0;properties&&i<properties.length;++i)
  2759. result[properties[i].name]=true;if(--pendingRequests==0)
  2760. callback(result);}
  2761. for(var i=0;i<selectedCallFrame.scopeChain.length;++i){var scope=selectedCallFrame.scopeChain[i];var object=this.target().runtimeModel.createRemoteObject(scope.object);pendingRequests++;object.getAllProperties(false,propertiesCollected);}},callStackModified:function(newCallFrames,details,asyncStackTrace)
  2762. {if(details&&details["stack_update_needs_step_in"])
  2763. this.stepInto();else if(newCallFrames&&newCallFrames.length)
  2764. this._pausedScript(newCallFrames,this._debuggerPausedDetails.reason,this._debuggerPausedDetails.auxData,this._debuggerPausedDetails.breakpointIds,asyncStackTrace);},_applySkipStackFrameSettings:function()
  2765. {this._agent.skipStackFrames(WebInspector.settings.skipStackFramesPattern.get(),WebInspector.settings.skipContentScripts.get());},functionDetails:function(remoteObject,callback)
  2766. {this._agent.getFunctionDetails(remoteObject.objectId,didGetDetails.bind(this));function didGetDetails(error,response)
  2767. {if(error){console.error(error);callback(null);return;}
  2768. var location=response.location;var script=this.scriptForId(location.scriptId);var rawLocation=script?this.createRawLocation(script,location.lineNumber,location.columnNumber||0):null;var sourceURL=script?script.contentURL():null;callback({location:rawLocation,sourceURL:sourceURL,functionName:response.functionName,scopeChain:response.scopeChain||null});}},generatorObjectDetails:function(remoteObject,callback)
  2769. {this._agent.getGeneratorObjectDetails(remoteObject.objectId,didGetDetails.bind(this));function didGetDetails(error,response)
  2770. {if(error){console.error(error);callback(null);return;}
  2771. var location=response.location;var script=location&&this.scriptForId(location.scriptId);var rawLocation=script?this.createRawLocation(script,location.lineNumber,location.columnNumber||0):null;var sourceURL=script?script.contentURL():null;callback({location:rawLocation,sourceURL:sourceURL,functionName:response.functionName,status:response.status});}},addBreakpointListener:function(breakpointId,listener,thisObject)
  2772. {this._breakpointResolvedEventTarget.addEventListener(breakpointId,listener,thisObject)},removeBreakpointListener:function(breakpointId,listener,thisObject)
  2773. {this._breakpointResolvedEventTarget.removeEventListener(breakpointId,listener,thisObject);},dispose:function()
  2774. {WebInspector.settings.pauseOnExceptionEnabled.removeChangeListener(this._pauseOnExceptionStateChanged,this);WebInspector.settings.pauseOnCaughtException.removeChangeListener(this._pauseOnExceptionStateChanged,this);WebInspector.settings.skipStackFramesPattern.removeChangeListener(this._applySkipStackFrameSettings,this);WebInspector.settings.skipContentScripts.removeChangeListener(this._applySkipStackFrameSettings,this);WebInspector.settings.enableAsyncStackTraces.removeChangeListener(this.asyncStackTracesStateChanged,this);},__proto__:WebInspector.SDKModel.prototype}
  2775. WebInspector.DebuggerEventTypes={JavaScriptPause:0,JavaScriptBreakpoint:1,NativeBreakpoint:2};WebInspector.DebuggerDispatcher=function(debuggerModel)
  2776. {this._debuggerModel=debuggerModel;}
  2777. WebInspector.DebuggerDispatcher.prototype={paused:function(callFrames,reason,auxData,breakpointIds,asyncStackTrace)
  2778. {this._debuggerModel._pausedScript(callFrames,reason,auxData,breakpointIds||[],asyncStackTrace);},resumed:function()
  2779. {this._debuggerModel._resumedScript();},globalObjectCleared:function()
  2780. {this._debuggerModel._globalObjectCleared();},scriptParsed:function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL,contextData)
  2781. {this._debuggerModel._parsedScriptSource(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,!!isContentScript,sourceMapURL,hasSourceURL,false,contextData);},scriptFailedToParse:function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL)
  2782. {this._debuggerModel._parsedScriptSource(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,!!isContentScript,sourceMapURL,hasSourceURL,true);},breakpointResolved:function(breakpointId,location)
  2783. {this._debuggerModel._breakpointResolved(breakpointId,location);}}
  2784. WebInspector.DebuggerModel.Location=function(target,scriptId,lineNumber,columnNumber)
  2785. {WebInspector.SDKObject.call(this,target);this._debuggerModel=target.debuggerModel;this.scriptId=scriptId;this.lineNumber=lineNumber;this.columnNumber=columnNumber||0;}
  2786. WebInspector.DebuggerModel.Location.fromPayload=function(target,payload)
  2787. {return new WebInspector.DebuggerModel.Location(target,payload.scriptId,payload.lineNumber,payload.columnNumber);}
  2788. WebInspector.DebuggerModel.Location.prototype={payload:function()
  2789. {return{scriptId:this.scriptId,lineNumber:this.lineNumber,columnNumber:this.columnNumber};},script:function()
  2790. {return this._debuggerModel.scriptForId(this.scriptId);},continueToLocation:function()
  2791. {this._debuggerModel._agent.continueToLocation(this.payload());},id:function()
  2792. {return this.target().id()+":"+this.scriptId+":"+this.lineNumber+":"+this.columnNumber;},__proto__:WebInspector.SDKObject.prototype}
  2793. WebInspector.DebuggerModel.CallFrame=function(target,script,payload,isAsync)
  2794. {WebInspector.SDKObject.call(this,target);this._debuggerAgent=target.debuggerModel._agent;this._script=script;this._payload=payload;this._isAsync=isAsync;this._location=WebInspector.DebuggerModel.Location.fromPayload(target,payload.location);}
  2795. WebInspector.DebuggerModel.CallFrame.fromPayloadArray=function(target,callFrames,isAsync)
  2796. {var result=[];for(var i=0;i<callFrames.length;++i){var callFrame=callFrames[i];var script=target.debuggerModel.scriptForId(callFrame.location.scriptId);if(script)
  2797. result.push(new WebInspector.DebuggerModel.CallFrame(target,script,callFrame,isAsync));}
  2798. return result;}
  2799. WebInspector.DebuggerModel.CallFrame.prototype={get script()
  2800. {return this._script;},get id()
  2801. {return this._payload.callFrameId;},get scopeChain()
  2802. {return this._payload.scopeChain;},thisObject:function()
  2803. {return this._payload.this?this.target().runtimeModel.createRemoteObject(this._payload.this):null;},returnValue:function()
  2804. {return this._payload.returnValue?this.target().runtimeModel.createRemoteObject(this._payload.returnValue):null;},get functionName()
  2805. {return this._payload.functionName;},location:function()
  2806. {return this._location;},isAsync:function()
  2807. {return!!this._isAsync;},evaluate:function(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
  2808. {function didEvaluateOnCallFrame(error,result,wasThrown,exceptionDetails)
  2809. {if(error){console.error(error);callback(null,false);return;}
  2810. callback(result,wasThrown,exceptionDetails);}
  2811. this._debuggerAgent.evaluateOnCallFrame(this._payload.callFrameId,code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,didEvaluateOnCallFrame);},restart:function(callback)
  2812. {function protocolCallback(error,callFrames,details,asyncStackTrace)
  2813. {if(!error)
  2814. this.target().debuggerModel.callStackModified(callFrames,details,asyncStackTrace);if(callback)
  2815. callback(error);}
  2816. this._debuggerAgent.restartFrame(this._payload.callFrameId,protocolCallback.bind(this));},__proto__:WebInspector.SDKObject.prototype}
  2817. WebInspector.DebuggerModel.StackTrace=function(callFrames,asyncStackTrace,description)
  2818. {this.callFrames=callFrames;this.asyncStackTrace=asyncStackTrace;this.description=description;}
  2819. WebInspector.DebuggerModel.StackTrace.fromPayload=function(target,payload,isAsync)
  2820. {if(!payload)
  2821. return null;var callFrames=WebInspector.DebuggerModel.CallFrame.fromPayloadArray(target,payload.callFrames,isAsync);if(!callFrames.length)
  2822. return null;var asyncStackTrace=WebInspector.DebuggerModel.StackTrace.fromPayload(target,payload.asyncStackTrace,true);return new WebInspector.DebuggerModel.StackTrace(callFrames,asyncStackTrace,payload.description);}
  2823. WebInspector.DebuggerPausedDetails=function(target,callFrames,reason,auxData,breakpointIds,asyncStackTrace)
  2824. {WebInspector.SDKObject.call(this,target);this.callFrames=WebInspector.DebuggerModel.CallFrame.fromPayloadArray(target,callFrames);this.reason=reason;this.auxData=auxData;this.breakpointIds=breakpointIds;this.asyncStackTrace=WebInspector.DebuggerModel.StackTrace.fromPayload(target,asyncStackTrace,true);}
  2825. WebInspector.DebuggerPausedDetails.prototype={exception:function()
  2826. {if(this.reason!==WebInspector.DebuggerModel.BreakReason.Exception&&this.reason!==WebInspector.DebuggerModel.BreakReason.PromiseRejection)
  2827. return null;return this.target().runtimeModel.createRemoteObject((this.auxData));},__proto__:WebInspector.SDKObject.prototype}
  2828. WebInspector.debuggerModel;;WebInspector.FileSystemModel=function(target)
  2829. {WebInspector.SDKObject.call(this,target);this._fileSystemsForOrigin={};target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);this._agent=target.fileSystemAgent();this._agent.enable();this._reset();}
  2830. WebInspector.FileSystemModel.prototype={_reset:function()
  2831. {for(var securityOrigin in this._fileSystemsForOrigin)
  2832. this._removeOrigin(securityOrigin);var securityOrigins=this.target().resourceTreeModel.securityOrigins();for(var i=0;i<securityOrigins.length;++i)
  2833. this._addOrigin(securityOrigins[i]);},_securityOriginAdded:function(event)
  2834. {var securityOrigin=(event.data);this._addOrigin(securityOrigin);},_securityOriginRemoved:function(event)
  2835. {var securityOrigin=(event.data);this._removeOrigin(securityOrigin);},_addOrigin:function(securityOrigin)
  2836. {this._fileSystemsForOrigin[securityOrigin]={};var types=["persistent","temporary"];for(var i=0;i<types.length;++i)
  2837. this._requestFileSystemRoot(securityOrigin,types[i],this._fileSystemRootReceived.bind(this,securityOrigin,types[i],this._fileSystemsForOrigin[securityOrigin]));},_removeOrigin:function(securityOrigin)
  2838. {for(var type in this._fileSystemsForOrigin[securityOrigin]){var fileSystem=this._fileSystemsForOrigin[securityOrigin][type];delete this._fileSystemsForOrigin[securityOrigin][type];this._fileSystemRemoved(fileSystem);}
  2839. delete this._fileSystemsForOrigin[securityOrigin];},_requestFileSystemRoot:function(origin,type,callback)
  2840. {function innerCallback(error,errorCode,backendRootEntry)
  2841. {if(error){callback(FileError.SECURITY_ERR);return;}
  2842. callback(errorCode,backendRootEntry);}
  2843. this._agent.requestFileSystemRoot(origin,type,innerCallback);},_fileSystemAdded:function(fileSystem)
  2844. {this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemAdded,fileSystem);},_fileSystemRemoved:function(fileSystem)
  2845. {this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemRemoved,fileSystem);},refreshFileSystemList:function()
  2846. {this._reset();},_fileSystemRootReceived:function(origin,type,store,errorCode,backendRootEntry)
  2847. {if(!errorCode&&backendRootEntry&&this._fileSystemsForOrigin[origin]===store){var fileSystem=new WebInspector.FileSystemModel.FileSystem(this,origin,type,backendRootEntry);store[type]=fileSystem;this._fileSystemAdded(fileSystem);}},requestDirectoryContent:function(directory,callback)
  2848. {this._requestDirectoryContent(directory.url,this._directoryContentReceived.bind(this,directory,callback));},_requestDirectoryContent:function(url,callback)
  2849. {function innerCallback(error,errorCode,backendEntries)
  2850. {if(error){callback(FileError.SECURITY_ERR);return;}
  2851. if(errorCode!==0){callback(errorCode);return;}
  2852. callback(errorCode,backendEntries);}
  2853. this._agent.requestDirectoryContent(url,innerCallback);},_directoryContentReceived:function(parentDirectory,callback,errorCode,backendEntries)
  2854. {if(!backendEntries){callback(errorCode);return;}
  2855. var entries=[];for(var i=0;i<backendEntries.length;++i){if(backendEntries[i].isDirectory)
  2856. entries.push(new WebInspector.FileSystemModel.Directory(this,parentDirectory.fileSystem,backendEntries[i]));else
  2857. entries.push(new WebInspector.FileSystemModel.File(this,parentDirectory.fileSystem,backendEntries[i]));}
  2858. callback(errorCode,entries);},requestMetadata:function(entry,callback)
  2859. {function innerCallback(error,errorCode,metadata)
  2860. {if(error){callback(FileError.SECURITY_ERR);return;}
  2861. callback(errorCode,metadata);}
  2862. this._agent.requestMetadata(entry.url,innerCallback);},requestFileContent:function(file,readAsText,start,end,charset,callback)
  2863. {this._requestFileContent(file.url,readAsText,start,end,charset,callback);},_requestFileContent:function(url,readAsText,start,end,charset,callback)
  2864. {function innerCallback(error,errorCode,content,charset)
  2865. {if(error){if(callback)
  2866. callback(FileError.SECURITY_ERR);return;}
  2867. if(callback)
  2868. callback(errorCode,content,charset);}
  2869. this._agent.requestFileContent(url,readAsText,start,end,charset,innerCallback);},deleteEntry:function(entry,callback)
  2870. {var fileSystemModel=this;if(entry===entry.fileSystem.root)
  2871. this._deleteEntry(entry.url,hookFileSystemDeletion);else
  2872. this._deleteEntry(entry.url,callback);function hookFileSystemDeletion(errorCode)
  2873. {callback(errorCode);if(!errorCode)
  2874. fileSystemModel._removeFileSystem(entry.fileSystem);}},_deleteEntry:function(url,callback)
  2875. {function innerCallback(error,errorCode)
  2876. {if(error){if(callback)
  2877. callback(FileError.SECURITY_ERR);return;}
  2878. if(callback)
  2879. callback(errorCode);}
  2880. this._agent.deleteEntry(url,innerCallback);},_removeFileSystem:function(fileSystem)
  2881. {var origin=fileSystem.origin;var type=fileSystem.type;if(this._fileSystemsForOrigin[origin]&&this._fileSystemsForOrigin[origin][type]){delete this._fileSystemsForOrigin[origin][type];this._fileSystemRemoved(fileSystem);if(Object.isEmpty(this._fileSystemsForOrigin[origin]))
  2882. delete this._fileSystemsForOrigin[origin];}},__proto__:WebInspector.SDKObject.prototype}
  2883. WebInspector.FileSystemModel.EventTypes={FileSystemAdded:"FileSystemAdded",FileSystemRemoved:"FileSystemRemoved"}
  2884. WebInspector.FileSystemModel.FileSystem=function(fileSystemModel,origin,type,backendRootEntry)
  2885. {this.origin=origin;this.type=type;this.root=new WebInspector.FileSystemModel.Directory(fileSystemModel,this,backendRootEntry);}
  2886. WebInspector.FileSystemModel.FileSystem.prototype={get name()
  2887. {return"filesystem:"+this.origin+"/"+this.type;}}
  2888. WebInspector.FileSystemModel.Entry=function(fileSystemModel,fileSystem,backendEntry)
  2889. {this._fileSystemModel=fileSystemModel;this._fileSystem=fileSystem;this._url=backendEntry.url;this._name=backendEntry.name;this._isDirectory=backendEntry.isDirectory;}
  2890. WebInspector.FileSystemModel.Entry.compare=function(x,y)
  2891. {if(x.isDirectory!=y.isDirectory)
  2892. return y.isDirectory?1:-1;return x.name.compareTo(y.name);}
  2893. WebInspector.FileSystemModel.Entry.prototype={get fileSystemModel()
  2894. {return this._fileSystemModel;},get fileSystem()
  2895. {return this._fileSystem;},get url()
  2896. {return this._url;},get name()
  2897. {return this._name;},get isDirectory()
  2898. {return this._isDirectory;},requestMetadata:function(callback)
  2899. {this.fileSystemModel.requestMetadata(this,callback);},deleteEntry:function(callback)
  2900. {this.fileSystemModel.deleteEntry(this,callback);}}
  2901. WebInspector.FileSystemModel.Directory=function(fileSystemModel,fileSystem,backendEntry)
  2902. {WebInspector.FileSystemModel.Entry.call(this,fileSystemModel,fileSystem,backendEntry);}
  2903. WebInspector.FileSystemModel.Directory.prototype={requestDirectoryContent:function(callback)
  2904. {this.fileSystemModel.requestDirectoryContent(this,callback);},__proto__:WebInspector.FileSystemModel.Entry.prototype}
  2905. WebInspector.FileSystemModel.File=function(fileSystemModel,fileSystem,backendEntry)
  2906. {WebInspector.FileSystemModel.Entry.call(this,fileSystemModel,fileSystem,backendEntry);this._mimeType=backendEntry.mimeType;this._resourceType=WebInspector.resourceTypes[backendEntry.resourceType];this._isTextFile=backendEntry.isTextFile;}
  2907. WebInspector.FileSystemModel.File.prototype={get mimeType()
  2908. {return this._mimeType;},get resourceType()
  2909. {return this._resourceType;},get isTextFile()
  2910. {return this._isTextFile;},requestFileContent:function(readAsText,start,end,charset,callback)
  2911. {this.fileSystemModel.requestFileContent(this,readAsText,start,end,charset,callback);},__proto__:WebInspector.FileSystemModel.Entry.prototype};WebInspector.HAREntry=function(request)
  2912. {this._request=request;}
  2913. WebInspector.HAREntry.prototype={build:function()
  2914. {var entry={startedDateTime:new Date(this._request.startTime*1000),time:this._request.timing?WebInspector.HAREntry._toMilliseconds(this._request.duration):0,request:this._buildRequest(),response:this._buildResponse(),cache:{},timings:this._buildTimings()};if(this._request.connectionId!=="0")
  2915. entry.connection=this._request.connectionId;var page=this._request.target().networkLog.pageLoadForRequest(this._request);if(page)
  2916. entry.pageref="page_"+page.id;return entry;},_buildRequest:function()
  2917. {var headersText=this._request.requestHeadersText();var res={method:this._request.requestMethod,url:this._buildRequestURL(this._request.url),httpVersion:this._request.requestHttpVersion(),headers:this._request.requestHeaders(),queryString:this._buildParameters(this._request.queryParameters||[]),cookies:this._buildCookies(this._request.requestCookies||[]),headersSize:headersText?headersText.length:-1,bodySize:this.requestBodySize};if(this._request.requestFormData)
  2918. res.postData=this._buildPostData();return res;},_buildResponse:function()
  2919. {var headersText=this._request.responseHeadersText;return{status:this._request.statusCode,statusText:this._request.statusText,httpVersion:this._request.responseHttpVersion(),headers:this._request.responseHeaders,cookies:this._buildCookies(this._request.responseCookies||[]),content:this._buildContent(),redirectURL:this._request.responseHeaderValue("Location")||"",headersSize:headersText?headersText.length:-1,bodySize:this.responseBodySize,_transferSize:this._request.transferSize,_error:this._request.localizedFailDescription};},_buildContent:function()
  2920. {var content={size:this._request.resourceSize,mimeType:this._request.mimeType||"x-unknown",};var compression=this.responseCompression;if(typeof compression==="number")
  2921. content.compression=compression;return content;},_buildTimings:function()
  2922. {var timing=this._request.timing;if(!timing)
  2923. return{blocked:-1,dns:-1,connect:-1,send:0,wait:0,receive:0,ssl:-1};function firstNonNegative(values)
  2924. {for(var i=0;i<values.length;++i){if(values[i]>=0)
  2925. return values[i];}
  2926. console.assert(false,"Incomplete request timing information.");}
  2927. var blocked=firstNonNegative([timing.dnsStart,timing.connectStart,timing.sendStart]);var dns=-1;if(timing.dnsStart>=0)
  2928. dns=firstNonNegative([timing.connectStart,timing.sendStart])-timing.dnsStart;var connect=-1;if(timing.connectStart>=0)
  2929. connect=timing.sendStart-timing.connectStart;var send=timing.sendEnd-timing.sendStart;var wait=timing.receiveHeadersEnd-timing.sendEnd;var receive=WebInspector.HAREntry._toMilliseconds(this._request.duration)-timing.receiveHeadersEnd;var ssl=-1;if(timing.sslStart>=0&&timing.sslEnd>=0)
  2930. ssl=timing.sslEnd-timing.sslStart;return{blocked:blocked,dns:dns,connect:connect,send:send,wait:wait,receive:receive,ssl:ssl};},_buildPostData:function()
  2931. {var res={mimeType:this._request.requestContentType(),text:this._request.requestFormData};if(this._request.formParameters)
  2932. res.params=this._buildParameters(this._request.formParameters);return res;},_buildParameters:function(parameters)
  2933. {return parameters.slice();},_buildRequestURL:function(url)
  2934. {return url.split("#",2)[0];},_buildCookies:function(cookies)
  2935. {return cookies.map(this._buildCookie.bind(this));},_buildCookie:function(cookie)
  2936. {return{name:cookie.name(),value:cookie.value(),path:cookie.path(),domain:cookie.domain(),expires:cookie.expiresDate(new Date(this._request.startTime*1000)),httpOnly:cookie.httpOnly(),secure:cookie.secure()};},get requestBodySize()
  2937. {return!this._request.requestFormData?0:this._request.requestFormData.length;},get responseBodySize()
  2938. {if(this._request.cached()||this._request.statusCode===304)
  2939. return 0;if(!this._request.responseHeadersText)
  2940. return-1;return this._request.transferSize-this._request.responseHeadersText.length;},get responseCompression()
  2941. {if(this._request.cached()||this._request.statusCode===304||this._request.statusCode===206)
  2942. return;if(!this._request.responseHeadersText)
  2943. return;return this._request.resourceSize-this.responseBodySize;}}
  2944. WebInspector.HAREntry._toMilliseconds=function(time)
  2945. {return time===-1?-1:time*1000;}
  2946. WebInspector.HARLog=function(requests)
  2947. {this._requests=requests;}
  2948. WebInspector.HARLog.prototype={build:function()
  2949. {return{version:"1.2",creator:this._creator(),pages:this._buildPages(),entries:this._requests.map(this._convertResource.bind(this))}},_creator:function()
  2950. {var webKitVersion=/AppleWebKit\/([^ ]+)/.exec(window.navigator.userAgent);return{name:"WebInspector",version:webKitVersion?webKitVersion[1]:"n/a"};},_buildPages:function()
  2951. {var seenIdentifiers={};var pages=[];for(var i=0;i<this._requests.length;++i){var page=this._requests[i].target().networkLog.pageLoadForRequest(this._requests[i]);if(!page||seenIdentifiers[page.id])
  2952. continue;seenIdentifiers[page.id]=true;pages.push(this._convertPage(page));}
  2953. return pages;},_convertPage:function(page)
  2954. {return{startedDateTime:new Date(page.startTime*1000),id:"page_"+page.id,title:page.url,pageTimings:{onContentLoad:this._pageEventTime(page,page.contentLoadTime),onLoad:this._pageEventTime(page,page.loadTime)}}},_convertResource:function(request)
  2955. {return(new WebInspector.HAREntry(request)).build();},_pageEventTime:function(page,time)
  2956. {var startTime=page.startTime;if(time===-1||startTime===-1)
  2957. return-1;return WebInspector.HAREntry._toMilliseconds(time-startTime);}};WebInspector.IndexedDBModel=function(target)
  2958. {WebInspector.SDKModel.call(this,WebInspector.IndexedDBModel,target);this._agent=target.indexedDBAgent();this._databases=new Map();this._databaseNamesBySecurityOrigin={};}
  2959. WebInspector.IndexedDBModel.KeyTypes={NumberType:"number",StringType:"string",DateType:"date",ArrayType:"array"};WebInspector.IndexedDBModel.KeyPathTypes={NullType:"null",StringType:"string",ArrayType:"array"};WebInspector.IndexedDBModel.keyFromIDBKey=function(idbKey)
  2960. {if(typeof(idbKey)==="undefined"||idbKey===null)
  2961. return null;var key={};switch(typeof(idbKey)){case"number":key.number=idbKey;key.type=WebInspector.IndexedDBModel.KeyTypes.NumberType;break;case"string":key.string=idbKey;key.type=WebInspector.IndexedDBModel.KeyTypes.StringType;break;case"object":if(idbKey instanceof Date){key.date=idbKey.getTime();key.type=WebInspector.IndexedDBModel.KeyTypes.DateType;}else if(Array.isArray(idbKey)){key.array=[];for(var i=0;i<idbKey.length;++i)
  2962. key.array.push(WebInspector.IndexedDBModel.keyFromIDBKey(idbKey[i]));key.type=WebInspector.IndexedDBModel.KeyTypes.ArrayType;}
  2963. break;default:return null;}
  2964. return key;}
  2965. WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange=function(idbKeyRange)
  2966. {if(typeof idbKeyRange==="undefined"||idbKeyRange===null)
  2967. return null;var keyRange={};keyRange.lower=WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.lower);keyRange.upper=WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.upper);keyRange.lowerOpen=idbKeyRange.lowerOpen;keyRange.upperOpen=idbKeyRange.upperOpen;return keyRange;}
  2968. WebInspector.IndexedDBModel.idbKeyPathFromKeyPath=function(keyPath)
  2969. {var idbKeyPath;switch(keyPath.type){case WebInspector.IndexedDBModel.KeyPathTypes.NullType:idbKeyPath=null;break;case WebInspector.IndexedDBModel.KeyPathTypes.StringType:idbKeyPath=keyPath.string;break;case WebInspector.IndexedDBModel.KeyPathTypes.ArrayType:idbKeyPath=keyPath.array;break;}
  2970. return idbKeyPath;}
  2971. WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath=function(idbKeyPath)
  2972. {if(typeof idbKeyPath==="string")
  2973. return"\""+idbKeyPath+"\"";if(idbKeyPath instanceof Array)
  2974. return"[\""+idbKeyPath.join("\", \"")+"\"]";return null;}
  2975. WebInspector.IndexedDBModel.EventTypes={DatabaseAdded:"DatabaseAdded",DatabaseRemoved:"DatabaseRemoved",DatabaseLoaded:"DatabaseLoaded"}
  2976. WebInspector.IndexedDBModel.prototype={enable:function()
  2977. {if(this._enabled)
  2978. return;this._agent.enable();this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);var securityOrigins=this.target().resourceTreeModel.securityOrigins();for(var i=0;i<securityOrigins.length;++i)
  2979. this._addOrigin(securityOrigins[i]);this._enabled=true;},refreshDatabaseNames:function()
  2980. {for(var securityOrigin in this._databaseNamesBySecurityOrigin)
  2981. this._loadDatabaseNames(securityOrigin);},refreshDatabase:function(databaseId)
  2982. {this._loadDatabase(databaseId);},clearObjectStore:function(databaseId,objectStoreName,callback)
  2983. {this._agent.clearObjectStore(databaseId.securityOrigin,databaseId.name,objectStoreName,callback);},_securityOriginAdded:function(event)
  2984. {var securityOrigin=(event.data);this._addOrigin(securityOrigin);},_securityOriginRemoved:function(event)
  2985. {var securityOrigin=(event.data);this._removeOrigin(securityOrigin);},_addOrigin:function(securityOrigin)
  2986. {console.assert(!this._databaseNamesBySecurityOrigin[securityOrigin]);this._databaseNamesBySecurityOrigin[securityOrigin]=[];this._loadDatabaseNames(securityOrigin);},_removeOrigin:function(securityOrigin)
  2987. {console.assert(this._databaseNamesBySecurityOrigin[securityOrigin]);for(var i=0;i<this._databaseNamesBySecurityOrigin[securityOrigin].length;++i)
  2988. this._databaseRemoved(securityOrigin,this._databaseNamesBySecurityOrigin[securityOrigin][i]);delete this._databaseNamesBySecurityOrigin[securityOrigin];},_updateOriginDatabaseNames:function(securityOrigin,databaseNames)
  2989. {var newDatabaseNames=databaseNames.keySet();var oldDatabaseNames=this._databaseNamesBySecurityOrigin[securityOrigin].keySet();this._databaseNamesBySecurityOrigin[securityOrigin]=databaseNames;for(var databaseName in oldDatabaseNames){if(!newDatabaseNames[databaseName])
  2990. this._databaseRemoved(securityOrigin,databaseName);}
  2991. for(var databaseName in newDatabaseNames){if(!oldDatabaseNames[databaseName])
  2992. this._databaseAdded(securityOrigin,databaseName);}},databases:function()
  2993. {var result=[];for(var securityOrigin in this._databaseNamesBySecurityOrigin){var databaseNames=this._databaseNamesBySecurityOrigin[securityOrigin];for(var i=0;i<databaseNames.length;++i){result.push(new WebInspector.IndexedDBModel.DatabaseId(securityOrigin,databaseNames[i]));}}
  2994. return result;},_databaseAdded:function(securityOrigin,databaseName)
  2995. {var databaseId=new WebInspector.IndexedDBModel.DatabaseId(securityOrigin,databaseName);this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseAdded,databaseId);},_databaseRemoved:function(securityOrigin,databaseName)
  2996. {var databaseId=new WebInspector.IndexedDBModel.DatabaseId(securityOrigin,databaseName);this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseRemoved,databaseId);},_loadDatabaseNames:function(securityOrigin)
  2997. {function callback(error,databaseNames)
  2998. {if(error){console.error("IndexedDBAgent error: "+error);return;}
  2999. if(!this._databaseNamesBySecurityOrigin[securityOrigin])
  3000. return;this._updateOriginDatabaseNames(securityOrigin,databaseNames);}
  3001. this._agent.requestDatabaseNames(securityOrigin,callback.bind(this));},_loadDatabase:function(databaseId)
  3002. {function callback(error,databaseWithObjectStores)
  3003. {if(error){console.error("IndexedDBAgent error: "+error);return;}
  3004. if(!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])
  3005. return;var databaseModel=new WebInspector.IndexedDBModel.Database(databaseId,databaseWithObjectStores.version,databaseWithObjectStores.intVersion);this._databases.set(databaseId,databaseModel);for(var i=0;i<databaseWithObjectStores.objectStores.length;++i){var objectStore=databaseWithObjectStores.objectStores[i];var objectStoreIDBKeyPath=WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(objectStore.keyPath);var objectStoreModel=new WebInspector.IndexedDBModel.ObjectStore(objectStore.name,objectStoreIDBKeyPath,objectStore.autoIncrement);for(var j=0;j<objectStore.indexes.length;++j){var index=objectStore.indexes[j];var indexIDBKeyPath=WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(index.keyPath);var indexModel=new WebInspector.IndexedDBModel.Index(index.name,indexIDBKeyPath,index.unique,index.multiEntry);objectStoreModel.indexes[indexModel.name]=indexModel;}
  3006. databaseModel.objectStores[objectStoreModel.name]=objectStoreModel;}
  3007. this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseLoaded,databaseModel);}
  3008. this._agent.requestDatabase(databaseId.securityOrigin,databaseId.name,callback.bind(this));},loadObjectStoreData:function(databaseId,objectStoreName,idbKeyRange,skipCount,pageSize,callback)
  3009. {this._requestData(databaseId,databaseId.name,objectStoreName,"",idbKeyRange,skipCount,pageSize,callback);},loadIndexData:function(databaseId,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback)
  3010. {this._requestData(databaseId,databaseId.name,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback);},_requestData:function(databaseId,databaseName,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback)
  3011. {function innerCallback(error,dataEntries,hasMore)
  3012. {if(error){console.error("IndexedDBAgent error: "+error);return;}
  3013. if(!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])
  3014. return;var entries=[];for(var i=0;i<dataEntries.length;++i){var key=WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].key));var primaryKey=WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].primaryKey));var value=WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].value));entries.push(new WebInspector.IndexedDBModel.Entry(key,primaryKey,value));}
  3015. callback(entries,hasMore);}
  3016. var keyRange=WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange);this._agent.requestData(databaseId.securityOrigin,databaseName,objectStoreName,indexName,skipCount,pageSize,keyRange?keyRange:undefined,innerCallback.bind(this));},__proto__:WebInspector.SDKModel.prototype}
  3017. WebInspector.IndexedDBModel.Entry=function(key,primaryKey,value)
  3018. {this.key=key;this.primaryKey=primaryKey;this.value=value;}
  3019. WebInspector.IndexedDBModel.DatabaseId=function(securityOrigin,name)
  3020. {this.securityOrigin=securityOrigin;this.name=name;}
  3021. WebInspector.IndexedDBModel.DatabaseId.prototype={equals:function(databaseId)
  3022. {return this.name===databaseId.name&&this.securityOrigin===databaseId.securityOrigin;},}
  3023. WebInspector.IndexedDBModel.Database=function(databaseId,version,intVersion)
  3024. {this.databaseId=databaseId;this.version=version;this.intVersion=intVersion;this.objectStores={};}
  3025. WebInspector.IndexedDBModel.ObjectStore=function(name,keyPath,autoIncrement)
  3026. {this.name=name;this.keyPath=keyPath;this.autoIncrement=autoIncrement;this.indexes={};}
  3027. WebInspector.IndexedDBModel.ObjectStore.prototype={get keyPathString()
  3028. {return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyPath);}}
  3029. WebInspector.IndexedDBModel.Index=function(name,keyPath,unique,multiEntry)
  3030. {this.name=name;this.keyPath=keyPath;this.unique=unique;this.multiEntry=multiEntry;}
  3031. WebInspector.IndexedDBModel.Index.prototype={get keyPathString()
  3032. {return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyPath);}};WebInspector.TracingLayerPayload;WebInspector.TracingLayerTile;WebInspector.LayerTreeModel=function(target)
  3033. {WebInspector.SDKModel.call(this,WebInspector.LayerTreeModel,target);target.registerLayerTreeDispatcher(new WebInspector.LayerTreeDispatcher(this));WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.MainFrameNavigated,this._onMainFrameNavigated,this);this._layerTree=null;}
  3034. WebInspector.LayerTreeModel.Events={LayerTreeChanged:"LayerTreeChanged",LayerPainted:"LayerPainted",}
  3035. WebInspector.LayerTreeModel.ScrollRectType={NonFastScrollable:{name:"NonFastScrollable",description:"Non fast scrollable"},TouchEventHandler:{name:"TouchEventHandler",description:"Touch event handler"},WheelEventHandler:{name:"WheelEventHandler",description:"Wheel event handler"},RepaintsOnScroll:{name:"RepaintsOnScroll",description:"Repaints on scroll"}}
  3036. WebInspector.LayerTreeModel.prototype={disable:function()
  3037. {if(!this._enabled)
  3038. return;this._enabled=false;this._layerTree=null;this.target().layerTreeAgent().disable();},enable:function()
  3039. {if(this._enabled)
  3040. return;this._enabled=true;this._forceEnable();},_forceEnable:function()
  3041. {this._layerTree=new WebInspector.AgentLayerTree(this.target());this._lastPaintRectByLayerId={};this.target().layerTreeAgent().enable();},setLayerTree:function(layerTree)
  3042. {this.disable();this._layerTree=layerTree;this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerTreeChanged);},layerTree:function()
  3043. {return this._layerTree;},_layerTreeChanged:function(layers)
  3044. {if(!this._enabled)
  3045. return;var layerTree=(this._layerTree);layerTree.setLayers(layers,onLayersSet.bind(this));function onLayersSet()
  3046. {for(var layerId in this._lastPaintRectByLayerId){var lastPaintRect=this._lastPaintRectByLayerId[layerId];var layer=layerTree.layerById(layerId);if(layer)
  3047. layer._lastPaintRect=lastPaintRect;}
  3048. this._lastPaintRectByLayerId={};this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerTreeChanged);}},_layerPainted:function(layerId,clipRect)
  3049. {if(!this._enabled)
  3050. return;var layerTree=(this._layerTree);var layer=layerTree.layerById(layerId);if(!layer){this._lastPaintRectByLayerId[layerId]=clipRect;return;}
  3051. layer._didPaint(clipRect);this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerPainted,layer);},_onMainFrameNavigated:function()
  3052. {if(this._enabled)
  3053. this._forceEnable();},__proto__:WebInspector.SDKModel.prototype}
  3054. WebInspector.LayerTreeBase=function(target)
  3055. {this._target=target;this._layersById={};this._backendNodeIdToNodeId={};this._reset();}
  3056. WebInspector.LayerTreeBase.prototype={_reset:function()
  3057. {this._root=null;this._contentRoot=null;},root:function()
  3058. {return this._root;},contentRoot:function()
  3059. {return this._contentRoot;},forEachLayer:function(callback,root)
  3060. {if(!root){root=this.root();if(!root)
  3061. return false;}
  3062. return callback(root)||root.children().some(this.forEachLayer.bind(this,callback));},layerById:function(id)
  3063. {return this._layersById[id]||null;},_resolveBackendNodeIds:function(requestedNodeIds,callback)
  3064. {if(!requestedNodeIds.length||!this._target){callback();return;}
  3065. this._target.domModel.pushNodesByBackendIdsToFrontend(requestedNodeIds,populateBackendNodeIdMap.bind(this));function populateBackendNodeIdMap(nodeIds)
  3066. {if(nodeIds){for(var i=0;i<requestedNodeIds.length;++i){var nodeId=nodeIds[i];if(nodeId)
  3067. this._backendNodeIdToNodeId[requestedNodeIds[i]]=nodeId;}}
  3068. callback();}},setViewportSize:function(viewportSize)
  3069. {this._viewportSize=viewportSize;},viewportSize:function()
  3070. {return this._viewportSize;},_nodeForId:function(id)
  3071. {return this._target?this._target.domModel.nodeForId(id):null;}};WebInspector.TracingLayerTree=function(target)
  3072. {WebInspector.LayerTreeBase.call(this,target);this._tileById=new Map();}
  3073. WebInspector.TracingLayerTree.prototype={setLayers:function(root,callback)
  3074. {var idsToResolve=[];this._extractNodeIdsToResolve(idsToResolve,{},root);this._resolveBackendNodeIds(idsToResolve,onBackendNodeIdsResolved.bind(this));function onBackendNodeIdsResolved()
  3075. {var oldLayersById=this._layersById;this._layersById={};this._contentRoot=null;this._root=this._innerSetLayers(oldLayersById,root);callback();}},setTiles:function(tiles)
  3076. {this._tileById=new Map();for(var tile of tiles)
  3077. this._tileById.set(tile.id,tile);},tileById:function(id)
  3078. {return this._tileById.get(id);},_innerSetLayers:function(oldLayersById,payload)
  3079. {var layer=(oldLayersById[payload.layer_id]);if(layer)
  3080. layer._reset(payload);else
  3081. layer=new WebInspector.TracingLayer(payload);this._layersById[payload.layer_id]=layer;if(payload.owner_node){if(!this._contentRoot&&payload.draws_content)
  3082. this._contentRoot=layer;if(this._backendNodeIdToNodeId[payload.owner_node])
  3083. layer._setNode(this._nodeForId(this._backendNodeIdToNodeId[payload.owner_node]));}
  3084. for(var i=0;payload.children&&i<payload.children.length;++i)
  3085. layer.addChild(this._innerSetLayers(oldLayersById,payload.children[i]));return layer;},_extractNodeIdsToResolve:function(nodeIdsToResolve,seenNodeIds,payload)
  3086. {var backendNodeId=payload.owner_node;if(backendNodeId&&!seenNodeIds[backendNodeId]&&!(this._backendNodeIdToNodeId[backendNodeId]&&this._nodeForId(backendNodeId))){seenNodeIds[backendNodeId]=true;nodeIdsToResolve.push(backendNodeId);}
  3087. for(var i=0;payload.children&&i<payload.children.length;++i)
  3088. this._extractNodeIdsToResolve(nodeIdsToResolve,seenNodeIds,payload.children[i]);},__proto__:WebInspector.LayerTreeBase.prototype}
  3089. WebInspector.AgentLayerTree=function(target)
  3090. {WebInspector.LayerTreeBase.call(this,target);}
  3091. WebInspector.AgentLayerTree.prototype={setLayers:function(payload,callback)
  3092. {if(!payload){onBackendNodeIdsResolved.call(this);return;}
  3093. var idsToResolve={};var requestedIds=[];for(var i=0;i<payload.length;++i){var backendNodeId=payload[i].backendNodeId;if(!backendNodeId||idsToResolve[backendNodeId]||(this._backendNodeIdToNodeId[backendNodeId]&&this._nodeForId(this._backendNodeIdToNodeId[backendNodeId]))){continue;}
  3094. idsToResolve[backendNodeId]=true;requestedIds.push(backendNodeId);}
  3095. this._resolveBackendNodeIds(requestedIds,onBackendNodeIdsResolved.bind(this));function onBackendNodeIdsResolved()
  3096. {this._innerSetLayers(payload);callback();}},_innerSetLayers:function(layers)
  3097. {this._reset();if(!layers)
  3098. return;var oldLayersById=this._layersById;this._layersById={};for(var i=0;i<layers.length;++i){var layerId=layers[i].layerId;var layer=oldLayersById[layerId];if(layer)
  3099. layer._reset(layers[i]);else
  3100. layer=new WebInspector.AgentLayer(this._target,layers[i]);this._layersById[layerId]=layer;if(layers[i].backendNodeId){layer._setNode(this._nodeForId(this._backendNodeIdToNodeId[layers[i].backendNodeId]));if(!this._contentRoot)
  3101. this._contentRoot=layer;}
  3102. var parentId=layer.parentId();if(parentId){var parent=this._layersById[parentId];if(!parent)
  3103. console.assert(parent,"missing parent "+parentId+" for layer "+layerId);parent.addChild(layer);}else{if(this._root)
  3104. console.assert(false,"Multiple root layers");this._root=layer;}}
  3105. if(this._root)
  3106. this._root._calculateQuad(new WebKitCSSMatrix());},__proto__:WebInspector.LayerTreeBase.prototype}
  3107. WebInspector.Layer=function()
  3108. {}
  3109. WebInspector.Layer.prototype={id:function(){},parentId:function(){},parent:function(){},isRoot:function(){},children:function(){},addChild:function(child){},node:function(){},nodeForSelfOrAncestor:function(){},offsetX:function(){},offsetY:function(){},width:function(){},height:function(){},transform:function(){},quad:function(){},anchorPoint:function(){},invisible:function(){},paintCount:function(){},lastPaintRect:function(){},scrollRects:function(){},requestCompositingReasons:function(callback){},requestSnapshot:function(callback){},}
  3110. WebInspector.AgentLayer=function(target,layerPayload)
  3111. {this._target=target;this._reset(layerPayload);}
  3112. WebInspector.AgentLayer.prototype={id:function()
  3113. {return this._layerPayload.layerId;},parentId:function()
  3114. {return this._layerPayload.parentLayerId;},parent:function()
  3115. {return this._parent;},isRoot:function()
  3116. {return!this.parentId();},children:function()
  3117. {return this._children;},addChild:function(child)
  3118. {if(child._parent)
  3119. console.assert(false,"Child already has a parent");this._children.push(child);child._parent=this;},_setNode:function(node)
  3120. {this._node=node;},node:function()
  3121. {return this._node;},nodeForSelfOrAncestor:function()
  3122. {for(var layer=this;layer;layer=layer._parent){if(layer._node)
  3123. return layer._node;}
  3124. return null;},offsetX:function()
  3125. {return this._layerPayload.offsetX;},offsetY:function()
  3126. {return this._layerPayload.offsetY;},width:function()
  3127. {return this._layerPayload.width;},height:function()
  3128. {return this._layerPayload.height;},transform:function()
  3129. {return this._layerPayload.transform;},quad:function()
  3130. {return this._quad;},anchorPoint:function()
  3131. {return[this._layerPayload.anchorX||0,this._layerPayload.anchorY||0,this._layerPayload.anchorZ||0,];},invisible:function()
  3132. {return this._layerPayload.invisible;},paintCount:function()
  3133. {return this._paintCount||this._layerPayload.paintCount;},lastPaintRect:function()
  3134. {return this._lastPaintRect;},scrollRects:function()
  3135. {return this._scrollRects;},requestCompositingReasons:function(callback)
  3136. {if(!this._target){callback([]);return;}
  3137. var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.reasonsForCompositingLayer(): ",undefined,[]);this._target.layerTreeAgent().compositingReasons(this.id(),wrappedCallback);},requestSnapshot:function(callback)
  3138. {if(!this._target){callback();return;}
  3139. var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.makeSnapshot(): ",WebInspector.PaintProfilerSnapshot.bind(null,this._target));this._target.layerTreeAgent().makeSnapshot(this.id(),wrappedCallback);},_didPaint:function(rect)
  3140. {this._lastPaintRect=rect;this._paintCount=this.paintCount()+1;this._image=null;},_reset:function(layerPayload)
  3141. {this._node=null;this._children=[];this._parent=null;this._paintCount=0;this._layerPayload=layerPayload;this._image=null;this._scrollRects=this._layerPayload.scrollRects||[];},_matrixFromArray:function(a)
  3142. {function toFixed9(x){return x.toFixed(9);}
  3143. return new WebKitCSSMatrix("matrix3d("+a.map(toFixed9).join(",")+")");},_calculateTransformToViewport:function(parentTransform)
  3144. {var offsetMatrix=new WebKitCSSMatrix().translate(this._layerPayload.offsetX,this._layerPayload.offsetY);var matrix=offsetMatrix;if(this._layerPayload.transform){var transformMatrix=this._matrixFromArray(this._layerPayload.transform);var anchorVector=new WebInspector.Geometry.Vector(this._layerPayload.width*this.anchorPoint()[0],this._layerPayload.height*this.anchorPoint()[1],this.anchorPoint()[2]);var anchorPoint=WebInspector.Geometry.multiplyVectorByMatrixAndNormalize(anchorVector,matrix);var anchorMatrix=new WebKitCSSMatrix().translate(-anchorPoint.x,-anchorPoint.y,-anchorPoint.z);matrix=anchorMatrix.inverse().multiply(transformMatrix.multiply(anchorMatrix.multiply(matrix)));}
  3145. matrix=parentTransform.multiply(matrix);return matrix;},_createVertexArrayForRect:function(width,height)
  3146. {return[0,0,0,width,0,0,width,height,0,0,height,0];},_calculateQuad:function(parentTransform)
  3147. {var matrix=this._calculateTransformToViewport(parentTransform);this._quad=[];var vertices=this._createVertexArrayForRect(this._layerPayload.width,this._layerPayload.height);for(var i=0;i<4;++i){var point=WebInspector.Geometry.multiplyVectorByMatrixAndNormalize(new WebInspector.Geometry.Vector(vertices[i*3],vertices[i*3+1],vertices[i*3+2]),matrix);this._quad.push(point.x,point.y);}
  3148. function calculateQuadForLayer(layer)
  3149. {layer._calculateQuad(matrix);}
  3150. this._children.forEach(calculateQuadForLayer);}}
  3151. WebInspector.TracingLayer=function(payload)
  3152. {this._reset(payload);}
  3153. WebInspector.TracingLayer.prototype={_reset:function(payload)
  3154. {this._node=null;this._layerId=String(payload.layer_id);this._offsetX=payload.position[0];this._offsetY=payload.position[1];this._width=payload.bounds.width;this._height=payload.bounds.height;this._children=[];this._parentLayerId=null;this._parent=null;this._quad=payload.layer_quad||[];this._createScrollRects(payload);this._compositingReasons=payload.compositing_reasons||[];},id:function()
  3155. {return this._layerId;},parentId:function()
  3156. {return this._parentLayerId;},parent:function()
  3157. {return this._parent;},isRoot:function()
  3158. {return!this.parentId();},children:function()
  3159. {return this._children;},addChild:function(child)
  3160. {if(child._parent)
  3161. console.assert(false,"Child already has a parent");this._children.push(child);child._parent=this;child._parentLayerId=this._layerId;},_setNode:function(node)
  3162. {this._node=node;},node:function()
  3163. {return this._node;},nodeForSelfOrAncestor:function()
  3164. {for(var layer=this;layer;layer=layer._parent){if(layer._node)
  3165. return layer._node;}
  3166. return null;},offsetX:function()
  3167. {return this._offsetX;},offsetY:function()
  3168. {return this._offsetY;},width:function()
  3169. {return this._width;},height:function()
  3170. {return this._height;},transform:function()
  3171. {return null;},quad:function()
  3172. {return this._quad;},anchorPoint:function()
  3173. {return[0.5,0.5,0];},invisible:function()
  3174. {return false;},paintCount:function()
  3175. {return 0;},lastPaintRect:function()
  3176. {return null;},scrollRects:function()
  3177. {return this._scrollRects;},_scrollRectsFromParams:function(params,type)
  3178. {return{rect:{x:params[0],y:params[1],width:params[2],height:params[3]},type:type};},_createScrollRects:function(payload)
  3179. {this._scrollRects=[];if(payload.non_fast_scrollable_region)
  3180. this._scrollRects.push(this._scrollRectsFromParams(payload.non_fast_scrollable_region,WebInspector.LayerTreeModel.ScrollRectType.NonFastScrollable.name));if(payload.touch_event_handler_region)
  3181. this._scrollRects.push(this._scrollRectsFromParams(payload.touch_event_handler_region,WebInspector.LayerTreeModel.ScrollRectType.TouchEventHandler.name));if(payload.wheel_event_handler_region)
  3182. this._scrollRects.push(this._scrollRectsFromParams(payload.wheel_event_handler_region,WebInspector.LayerTreeModel.ScrollRectType.WheelEventHandler.name));if(payload.scroll_event_handler_region)
  3183. this._scrollRects.push(this._scrollRectsFromParams(payload.scroll_event_handler_region,WebInspector.LayerTreeModel.ScrollRectType.RepaintsOnScroll.name));},requestCompositingReasons:function(callback)
  3184. {callback(this._compositingReasons);},requestSnapshot:function(callback)
  3185. {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.makeSnapshot(): ",WebInspector.PaintProfilerSnapshot);LayerTreeAgent.makeSnapshot(this.id(),wrappedCallback);}}
  3186. WebInspector.DeferredLayerTree=function(target)
  3187. {this._target=target;}
  3188. WebInspector.DeferredLayerTree.prototype={resolve:function(callback){},target:function()
  3189. {return this._target;}};WebInspector.LayerTreeDispatcher=function(layerTreeModel)
  3190. {this._layerTreeModel=layerTreeModel;}
  3191. WebInspector.LayerTreeDispatcher.prototype={layerTreeDidChange:function(layers)
  3192. {this._layerTreeModel._layerTreeChanged(layers||null);},layerPainted:function(layerId,clipRect)
  3193. {this._layerTreeModel._layerPainted(layerId,clipRect);}};WebInspector.NetworkLog=function(target)
  3194. {WebInspector.SDKObject.call(this,target);this._requests=[];this._requestForId={};target.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestStarted,this._onRequestStarted,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._onLoad,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded,this._onDOMContentLoaded,this);}
  3195. WebInspector.NetworkLog.prototype={get requests()
  3196. {return this._requests;},requestForURL:function(url)
  3197. {for(var i=0;i<this._requests.length;++i){if(this._requests[i].url===url)
  3198. return this._requests[i];}
  3199. return null;},pageLoadForRequest:function(request)
  3200. {return request.__page;},_onMainFrameNavigated:function(event)
  3201. {var mainFrame=event.data;this._currentPageLoad=null;var oldRequests=this._requests.splice(0,this._requests.length);this._requestForId={};for(var i=0;i<oldRequests.length;++i){var request=oldRequests[i];if(request.loaderId===mainFrame.loaderId){if(!this._currentPageLoad)
  3202. this._currentPageLoad=new WebInspector.PageLoad(request);this._requests.push(request);this._requestForId[request.requestId]=request;request.__page=this._currentPageLoad;}}},_onRequestStarted:function(event)
  3203. {var request=(event.data);this._requests.push(request);this._requestForId[request.requestId]=request;request.__page=this._currentPageLoad;},_onDOMContentLoaded:function(event)
  3204. {if(this._currentPageLoad)
  3205. this._currentPageLoad.contentLoadTime=event.data;},_onLoad:function(event)
  3206. {if(this._currentPageLoad)
  3207. this._currentPageLoad.loadTime=event.data;},requestForId:function(requestId)
  3208. {return this._requestForId[requestId];},__proto__:WebInspector.SDKObject.prototype}
  3209. WebInspector.networkLog;WebInspector.PageLoad=function(mainRequest)
  3210. {this.id=++WebInspector.PageLoad._lastIdentifier;this.url=mainRequest.url;this.startTime=mainRequest.startTime;}
  3211. WebInspector.PageLoad._lastIdentifier=0;;WebInspector.OverridesSupport=function(responsiveDesignAvailable)
  3212. {this._touchEmulationSuspended=false;this._emulateMobileEnabled=false;this._userAgent="";this._pageResizer=null;this._deviceScale=1;this._fixedDeviceScale=false;this._initialized=false;this._deviceMetricsThrottler=new WebInspector.Throttler(0);this._responsiveDesignAvailable=responsiveDesignAvailable;this.settings={};this.settings._emulationEnabled=WebInspector.settings.createSetting("emulationEnabled",false);this.settings.userAgent=WebInspector.settings.createSetting("userAgent","");this.settings.emulateResolution=WebInspector.settings.createSetting("emulateResolution",true);this.settings.deviceWidth=WebInspector.settings.createSetting("deviceWidth",360);this.settings.deviceHeight=WebInspector.settings.createSetting("deviceHeight",640);this.settings.deviceScaleFactor=WebInspector.settings.createSetting("deviceScaleFactor",0);this.settings.deviceFitWindow=WebInspector.settings.createSetting("deviceFitWindow",true);this.settings.emulateMobile=WebInspector.settings.createSetting("emulateMobile",false);this.settings.customDevicePresets=WebInspector.settings.createSetting("customDevicePresets",[]);this.settings.emulateTouch=WebInspector.settings.createSetting("emulateTouch",false);this.settings.overrideGeolocation=WebInspector.settings.createSetting("overrideGeolocation",false);this.settings.geolocationOverride=WebInspector.settings.createSetting("geolocationOverride","");this.settings.overrideDeviceOrientation=WebInspector.settings.createSetting("overrideDeviceOrientation",false);this.settings.deviceOrientationOverride=WebInspector.settings.createSetting("deviceOrientationOverride","");this.settings.overrideCSSMedia=WebInspector.settings.createSetting("overrideCSSMedia",false);this.settings.emulatedCSSMedia=WebInspector.settings.createSetting("emulatedCSSMedia","print");this.settings.networkConditions=WebInspector.settings.createSetting("networkConditions",{throughput:WebInspector.OverridesSupport.NetworkThroughputUnlimitedValue,latency:0});WebInspector.targetManager.observeTargets(this);}
  3213. WebInspector.OverridesSupport.Events={OverridesWarningUpdated:"OverridesWarningUpdated",EmulationStateChanged:"EmulationStateChanged"}
  3214. WebInspector.OverridesSupport.MaxDeviceSize=9999;WebInspector.OverridesSupport.PageResizer=function()
  3215. {};WebInspector.OverridesSupport.PageResizer.Events={AvailableSizeChanged:"AvailableSizeChanged",ResizeRequested:"ResizeRequested",FixedScaleRequested:"FixedScaleRequested"};WebInspector.OverridesSupport.PageResizer.prototype={update:function(dipWidth,dipHeight,scale){}};WebInspector.OverridesSupport.Device={};WebInspector.OverridesSupport.GeolocationPosition=function(latitude,longitude,error)
  3216. {this.latitude=latitude;this.longitude=longitude;this.error=error;}
  3217. WebInspector.OverridesSupport.GeolocationPosition.prototype={toSetting:function()
  3218. {return(typeof this.latitude==="number"&&typeof this.longitude==="number"&&typeof this.error==="string")?this.latitude+"@"+this.longitude+":"+this.error:"";}}
  3219. WebInspector.OverridesSupport.GeolocationPosition.parseSetting=function(value)
  3220. {if(value){var splitError=value.split(":");if(splitError.length===2){var splitPosition=splitError[0].split("@");if(splitPosition.length===2)
  3221. return new WebInspector.OverridesSupport.GeolocationPosition(parseFloat(splitPosition[0]),parseFloat(splitPosition[1]),splitError[1]);}}
  3222. return new WebInspector.OverridesSupport.GeolocationPosition(0,0,"");}
  3223. WebInspector.OverridesSupport.GeolocationPosition.parseUserInput=function(latitudeString,longitudeString,errorStatus)
  3224. {function isUserInputValid(value)
  3225. {if(!value)
  3226. return true;return/^[-]?[0-9]*[.]?[0-9]*$/.test(value);}
  3227. if(!latitudeString&&!longitudeString)
  3228. return null;var isLatitudeValid=isUserInputValid(latitudeString);var isLongitudeValid=isUserInputValid(longitudeString);if(!isLatitudeValid&&!isLongitudeValid)
  3229. return null;var latitude=isLatitudeValid?parseFloat(latitudeString):-1;var longitude=isLongitudeValid?parseFloat(longitudeString):-1;return new WebInspector.OverridesSupport.GeolocationPosition(latitude,longitude,errorStatus?"PositionUnavailable":"");}
  3230. WebInspector.OverridesSupport.GeolocationPosition.clearGeolocationOverride=function()
  3231. {PageAgent.clearGeolocationOverride();}
  3232. WebInspector.OverridesSupport.DeviceOrientation=function(alpha,beta,gamma)
  3233. {this.alpha=alpha;this.beta=beta;this.gamma=gamma;}
  3234. WebInspector.OverridesSupport.DeviceOrientation.prototype={toSetting:function()
  3235. {return JSON.stringify(this);}}
  3236. WebInspector.OverridesSupport.DeviceOrientation.parseSetting=function(value)
  3237. {if(value){var jsonObject=JSON.parse(value);return new WebInspector.OverridesSupport.DeviceOrientation(jsonObject.alpha,jsonObject.beta,jsonObject.gamma);}
  3238. return new WebInspector.OverridesSupport.DeviceOrientation(0,0,0);}
  3239. WebInspector.OverridesSupport.DeviceOrientation.parseUserInput=function(alphaString,betaString,gammaString)
  3240. {function isUserInputValid(value)
  3241. {if(!value)
  3242. return true;return/^[-]?[0-9]*[.]?[0-9]*$/.test(value);}
  3243. if(!alphaString&&!betaString&&!gammaString)
  3244. return null;var isAlphaValid=isUserInputValid(alphaString);var isBetaValid=isUserInputValid(betaString);var isGammaValid=isUserInputValid(gammaString);if(!isAlphaValid&&!isBetaValid&&!isGammaValid)
  3245. return null;var alpha=isAlphaValid?parseFloat(alphaString):-1;var beta=isBetaValid?parseFloat(betaString):-1;var gamma=isGammaValid?parseFloat(gammaString):-1;return new WebInspector.OverridesSupport.DeviceOrientation(alpha,beta,gamma);}
  3246. WebInspector.OverridesSupport.DeviceOrientation.clearDeviceOrientationOverride=function()
  3247. {PageAgent.clearDeviceOrientationOverride();}
  3248. WebInspector.OverridesSupport.deviceSizeValidator=function(value)
  3249. {if(!value||(/^[\d]+$/.test(value)&&value>=0&&value<=WebInspector.OverridesSupport.MaxDeviceSize))
  3250. return"";return WebInspector.UIString("Value must be non-negative integer");}
  3251. WebInspector.OverridesSupport.deviceScaleFactorValidator=function(value)
  3252. {if(!value||(/^[\d]+(\.\d+)?|\.\d+$/.test(value)&&value>=0&&value<=10))
  3253. return"";return WebInspector.UIString("Value must be non-negative float");}
  3254. WebInspector.OverridesSupport.NetworkThroughputUnlimitedValue=-1;WebInspector.OverridesSupport.NetworkConditionsPreset;WebInspector.OverridesSupport.prototype={canEmulate:function()
  3255. {return!!this._target&&this._target.canEmulate();},emulationEnabled:function()
  3256. {return this.canEmulate()&&this.settings._emulationEnabled.get();},setEmulationEnabled:function(enabled)
  3257. {if(this.canEmulate()){this.settings._emulationEnabled.set(enabled);this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.EmulationStateChanged);if(enabled&&this.settings.emulateResolution.get())
  3258. this._target.pageAgent().resetScrollAndPageScaleFactor();}},responsiveDesignAvailable:function()
  3259. {return this._responsiveDesignAvailable;},setPageResizer:function(pageResizer,availableSize)
  3260. {if(pageResizer===this._pageResizer)
  3261. return;if(this._pageResizer){this._pageResizer.removeEventListener(WebInspector.OverridesSupport.PageResizer.Events.AvailableSizeChanged,this._onPageResizerAvailableSizeChanged,this);this._pageResizer.removeEventListener(WebInspector.OverridesSupport.PageResizer.Events.ResizeRequested,this._onPageResizerResizeRequested,this);this._pageResizer.removeEventListener(WebInspector.OverridesSupport.PageResizer.Events.FixedScaleRequested,this._onPageResizerFixedScaleRequested,this);}
  3262. this._pageResizer=pageResizer;this._pageResizerAvailableSize=availableSize;if(this._pageResizer){this._pageResizer.addEventListener(WebInspector.OverridesSupport.PageResizer.Events.AvailableSizeChanged,this._onPageResizerAvailableSizeChanged,this);this._pageResizer.addEventListener(WebInspector.OverridesSupport.PageResizer.Events.ResizeRequested,this._onPageResizerResizeRequested,this);this._pageResizer.addEventListener(WebInspector.OverridesSupport.PageResizer.Events.FixedScaleRequested,this._onPageResizerFixedScaleRequested,this);}
  3263. if(this._initialized)
  3264. this._deviceMetricsChanged();},emulateDevice:function(device)
  3265. {this._deviceMetricsChangedListenerMuted=true;this._userAgentChangedListenerMuted=true;this.settings.userAgent.set(device.userAgent);this.settings.emulateResolution.set(true);this.settings.deviceWidth.set(device.width);this.settings.deviceHeight.set(device.height);this.settings.deviceScaleFactor.set(device.deviceScaleFactor);this.settings.emulateTouch.set(device.touch);this.settings.emulateMobile.set(device.mobile);delete this._deviceMetricsChangedListenerMuted;delete this._userAgentChangedListenerMuted;if(this._initialized){this._deviceMetricsChanged();this._userAgentChanged();this._target.pageAgent().resetScrollAndPageScaleFactor();}},reset:function()
  3266. {this._deviceMetricsChangedListenerMuted=true;this._userAgentChangedListenerMuted=true;this.settings.userAgent.set("");this.settings.emulateResolution.set(false);this.settings.deviceScaleFactor.set(0);this.settings.emulateTouch.set(false);this.settings.emulateMobile.set(false);this.settings.overrideDeviceOrientation.set(false);this.settings.overrideGeolocation.set(false);this.settings.overrideCSSMedia.set(false);this.settings.networkConditions.set({throughput:WebInspector.OverridesSupport.NetworkThroughputUnlimitedValue,latency:0});delete this._deviceMetricsChangedListenerMuted;delete this._userAgentChangedListenerMuted;if(this._initialized){this._deviceMetricsChanged();this._userAgentChanged();}},isEmulatingDevice:function(device)
  3267. {var sameResolution=this.settings.emulateResolution.get()?(this.settings.deviceWidth.get()===device.width&&this.settings.deviceHeight.get()===device.height&&this.settings.deviceScaleFactor.get()===device.deviceScaleFactor):(!device.width&&!device.height&&!device.deviceScaleFactor);return this.settings.userAgent.get()===device.userAgent&&this.settings.emulateTouch.get()===device.touch&&this.settings.emulateMobile.get()===device.mobile&&sameResolution;},deviceFromCurrentSettings:function()
  3268. {var device={};if(this.settings.emulateResolution.get()){device.width=this.settings.deviceWidth.get();device.height=this.settings.deviceHeight.get();}else{device.width=0;device.height=0;}
  3269. device.deviceScaleFactor=this.settings.deviceScaleFactor.get();device.touch=this.settings.emulateTouch.get();device.mobile=this.settings.emulateMobile.get();device.userAgent=this.settings.userAgent.get();device.title="";return device;},setTouchEmulationSuspended:function(suspended)
  3270. {this._touchEmulationSuspended=suspended;if(this._initialized)
  3271. this._emulateTouchEventsChanged();},applyInitialOverrides:function()
  3272. {if(!this._target){this._applyInitialOverridesOnTargetAdded=true;return;}
  3273. this._initialized=true;this.settings._emulationEnabled.addChangeListener(this._userAgentChanged,this);this.settings.userAgent.addChangeListener(this._userAgentChanged,this);this.settings._emulationEnabled.addChangeListener(this._deviceMetricsChanged,this);this.settings.emulateResolution.addChangeListener(this._deviceMetricsChanged,this);this.settings.deviceWidth.addChangeListener(this._deviceMetricsChanged,this);this.settings.deviceHeight.addChangeListener(this._deviceMetricsChanged,this);this.settings.deviceScaleFactor.addChangeListener(this._deviceMetricsChanged,this);this.settings.emulateMobile.addChangeListener(this._deviceMetricsChanged,this);this.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChanged,this);this.settings._emulationEnabled.addChangeListener(this._geolocationPositionChanged,this);this.settings.overrideGeolocation.addChangeListener(this._geolocationPositionChanged,this);this.settings.geolocationOverride.addChangeListener(this._geolocationPositionChanged,this);this.settings._emulationEnabled.addChangeListener(this._deviceOrientationChanged,this);this.settings.overrideDeviceOrientation.addChangeListener(this._deviceOrientationChanged,this);this.settings.deviceOrientationOverride.addChangeListener(this._deviceOrientationChanged,this);this.settings._emulationEnabled.addChangeListener(this._emulateTouchEventsChanged,this);this.settings.emulateTouch.addChangeListener(this._emulateTouchEventsChanged,this);this.settings._emulationEnabled.addChangeListener(this._cssMediaChanged,this);this.settings.overrideCSSMedia.addChangeListener(this._cssMediaChanged,this);this.settings.emulatedCSSMedia.addChangeListener(this._cssMediaChanged,this);this.settings._emulationEnabled.addChangeListener(this._networkConditionsChanged,this);this.settings.networkConditions.addChangeListener(this._networkConditionsChanged,this);this.settings._emulationEnabled.addChangeListener(this._showRulersChanged,this);WebInspector.settings.showMetricsRulers.addChangeListener(this._showRulersChanged,this);this._showRulersChanged();if(!this.emulationEnabled())
  3274. return;if(this.settings.overrideDeviceOrientation.get())
  3275. this._deviceOrientationChanged();if(this.settings.overrideGeolocation.get())
  3276. this._geolocationPositionChanged();if(this.settings.emulateTouch.get())
  3277. this._emulateTouchEventsChanged();if(this.settings.overrideCSSMedia.get())
  3278. this._cssMediaChanged();this._deviceMetricsChanged();if(this.settings.emulateResolution.get())
  3279. this._target.pageAgent().resetScrollAndPageScaleFactor();this._userAgentChanged();if(this.networkThroughputIsLimited())
  3280. this._networkConditionsChanged();},_userAgentChanged:function()
  3281. {if(this._userAgentChangedListenerMuted)
  3282. return;var userAgent=this.emulationEnabled()?this.settings.userAgent.get():"";NetworkAgent.setUserAgentOverride(userAgent);if(this._userAgent!==userAgent)
  3283. this._updateUserAgentWarningMessage(WebInspector.UIString("You might need to reload the page for proper user agent spoofing and viewport rendering."));this._userAgent=userAgent;},_onPageResizerAvailableSizeChanged:function(event)
  3284. {this._pageResizerAvailableSize=(event.data);if(this._initialized)
  3285. this._deviceMetricsChanged();},_onPageResizerResizeRequested:function(event)
  3286. {if(typeof event.data.width!=="undefined"){var width=(event.data.width);if(width!==this.settings.deviceWidth.get())
  3287. this.settings.deviceWidth.set(width);}
  3288. if(typeof event.data.height!=="undefined"){var height=(event.data.height);if(height!==this.settings.deviceHeight.get())
  3289. this.settings.deviceHeight.set(height);}},_onPageResizerFixedScaleRequested:function(event)
  3290. {this._fixedDeviceScale=(event.data);if(this._initialized)
  3291. this._deviceMetricsChanged();},_deviceMetricsChanged:function()
  3292. {this._showRulersChanged();if(this._deviceMetricsChangedListenerMuted)
  3293. return;if(!this.emulationEnabled()){this._deviceMetricsThrottler.schedule(clearDeviceMetricsOverride.bind(this));if(this._pageResizer)
  3294. this._pageResizer.update(0,0,1);return;}
  3295. var dipWidth=this.settings.emulateResolution.get()?this.settings.deviceWidth.get():0;var dipHeight=this.settings.emulateResolution.get()?this.settings.deviceHeight.get():0;var overrideWidth=dipWidth;var overrideHeight=dipHeight;var scale=1;if(this._pageResizer){var available=this._pageResizerAvailableSize;if(this.settings.deviceFitWindow.get()){if(this._fixedDeviceScale){scale=this._deviceScale;}else{scale=1;while(available.width<dipWidth*scale||available.height<dipHeight*scale)
  3296. scale*=0.8;}}
  3297. this._pageResizer.update(Math.min(dipWidth*scale,available.width),Math.min(dipHeight*scale,available.height),scale);if(scale===1&&available.width>=dipWidth&&available.height>=dipHeight){overrideWidth=0;overrideHeight=0;}
  3298. if(dipWidth===0&&dipHeight!==0)
  3299. overrideWidth=Math.round(available.width/scale);if(dipHeight===0&&dipWidth!==0)
  3300. overrideHeight=Math.round(available.height/scale);}
  3301. this._deviceScale=scale;this._deviceMetricsThrottler.schedule(setDeviceMetricsOverride.bind(this));function setDeviceMetricsOverride(finishCallback)
  3302. {this._target.pageAgent().setDeviceMetricsOverride(overrideWidth,overrideHeight,this.settings.emulateResolution.get()?this.settings.deviceScaleFactor.get():0,this.settings.emulateMobile.get(),this._pageResizer?false:this.settings.deviceFitWindow.get(),scale,0,0,apiCallback.bind(this,finishCallback));}
  3303. function clearDeviceMetricsOverride(finishCallback)
  3304. {this._target.pageAgent().clearDeviceMetricsOverride(apiCallback.bind(this,finishCallback));}
  3305. function apiCallback(finishCallback,error)
  3306. {if(error){this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Screen emulation is not available on this page."));this._deviceMetricsOverrideAppliedForTest();finishCallback();return;}
  3307. var mobileEnabled=this.emulationEnabled()&&this.settings.emulateMobile.get();if(this._emulateMobileEnabled!==mobileEnabled)
  3308. this._updateDeviceMetricsWarningMessage(WebInspector.UIString("You might need to reload the page for proper user agent spoofing and viewport rendering."));this._emulateMobileEnabled=mobileEnabled;this._deviceMetricsOverrideAppliedForTest();finishCallback();}},_deviceMetricsOverrideAppliedForTest:function()
  3309. {},_geolocationPositionChanged:function()
  3310. {if(!this.emulationEnabled()||!this.settings.overrideGeolocation.get()){PageAgent.clearGeolocationOverride();return;}
  3311. var geolocation=WebInspector.OverridesSupport.GeolocationPosition.parseSetting(this.settings.geolocationOverride.get());if(geolocation.error)
  3312. PageAgent.setGeolocationOverride();else
  3313. PageAgent.setGeolocationOverride(geolocation.latitude,geolocation.longitude,150);},_deviceOrientationChanged:function()
  3314. {if(!this.emulationEnabled()||!this.settings.overrideDeviceOrientation.get()){PageAgent.clearDeviceOrientationOverride();return;}
  3315. var deviceOrientation=WebInspector.OverridesSupport.DeviceOrientation.parseSetting(this.settings.deviceOrientationOverride.get());PageAgent.setDeviceOrientationOverride(deviceOrientation.alpha,deviceOrientation.beta,deviceOrientation.gamma);},_emulateTouchEventsChanged:function()
  3316. {var emulateTouch=this.emulationEnabled()&&this.settings.emulateTouch.get()&&!this._touchEmulationSuspended;var targets=WebInspector.targetManager.targets();for(var i=0;i<targets.length;++i)
  3317. targets[i].domModel.emulateTouchEventObjects(emulateTouch,this.settings.emulateMobile.get()?"mobile":"desktop");},_cssMediaChanged:function()
  3318. {var enabled=this.emulationEnabled()&&this.settings.overrideCSSMedia.get();PageAgent.setEmulatedMedia(enabled?this.settings.emulatedCSSMedia.get():"");var targets=WebInspector.targetManager.targets();for(var i=0;i<targets.length;++i)
  3319. targets[i].cssModel.mediaQueryResultChanged();},_networkConditionsChanged:function()
  3320. {if(!this.emulationEnabled()||!this.networkThroughputIsLimited()){NetworkAgent.emulateNetworkConditions(false,0,0,0);}else{var conditions=this.settings.networkConditions.get();var throughput=conditions.throughput;var latency=conditions.latency;var offline=!throughput&&!latency;NetworkAgent.emulateNetworkConditions(offline,latency,throughput,throughput);}},_pageResizerActive:function()
  3321. {return this._pageResizer&&this.emulationEnabled();},showMetricsRulers:function()
  3322. {return WebInspector.settings.showMetricsRulers.get()&&!this._pageResizerActive();},showExtensionLines:function()
  3323. {return WebInspector.settings.showMetricsRulers.get();},_showRulersChanged:function()
  3324. {PageAgent.setShowViewportSizeOnResize(!this._pageResizerActive(),WebInspector.settings.showMetricsRulers.get());},_onMainFrameNavigated:function()
  3325. {if(this._initialized)
  3326. this._deviceMetricsChanged();this._updateUserAgentWarningMessage("");this._updateDeviceMetricsWarningMessage("");},_dispatchWarningChanged:function()
  3327. {this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.OverridesWarningUpdated);},_updateDeviceMetricsWarningMessage:function(warningMessage)
  3328. {this._deviceMetricsWarningMessage=warningMessage;this._dispatchWarningChanged();},_updateUserAgentWarningMessage:function(warningMessage)
  3329. {this._userAgentWarningMessage=warningMessage;this._dispatchWarningChanged();},warningMessage:function()
  3330. {return this._deviceMetricsWarningMessage||this._userAgentWarningMessage||"";},clearWarningMessage:function()
  3331. {this._deviceMetricsWarningMessage="";this._userAgentWarningMessage="";this._dispatchWarningChanged();},targetAdded:function(target)
  3332. {if(this._target)
  3333. return;this._target=target;target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated,this);if(this._applyInitialOverridesOnTargetAdded){delete this._applyInitialOverridesOnTargetAdded;this.applyInitialOverrides();}
  3334. this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.EmulationStateChanged);},swapDimensions:function()
  3335. {var width=WebInspector.overridesSupport.settings.deviceWidth.get();var height=WebInspector.overridesSupport.settings.deviceHeight.get();WebInspector.overridesSupport.settings.deviceWidth.set(height);WebInspector.overridesSupport.settings.deviceHeight.set(width);},targetRemoved:function(target)
  3336. {if(target===this._target){target.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated,this);delete this._target;this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.EmulationStateChanged);}},networkThroughputIsLimited:function()
  3337. {var conditions=this.settings.networkConditions.get();return conditions.throughput!==WebInspector.OverridesSupport.NetworkThroughputUnlimitedValue;},__proto__:WebInspector.Object.prototype}
  3338. WebInspector.overridesSupport;;WebInspector.PowerProfiler=function(target)
  3339. {WebInspector.Object.call(this);this._dispatcher=new WebInspector.PowerDispatcher(this);this._target=target;target.registerPowerDispatcher(this._dispatcher);target.powerAgent().getAccuracyLevel(this._onAccuracyLevel.bind(this));}
  3340. WebInspector.PowerProfiler.EventTypes={PowerEventRecorded:"PowerEventRecorded"}
  3341. WebInspector.PowerProfiler.prototype={startProfile:function()
  3342. {this._target.powerAgent().start();},stopProfile:function()
  3343. {this._target.powerAgent().end();},getAccuracyLevel:function()
  3344. {return this._accuracyLevel;},_onAccuracyLevel:function(error,result){this._accuracyLevel="";if(error){console.log("Unable to retrieve PowerProfiler accuracy level: "+error);return;}
  3345. this._accuracyLevel=result;},__proto__:WebInspector.Object.prototype}
  3346. WebInspector.PowerDispatcher=function(profiler)
  3347. {this._profiler=profiler;}
  3348. WebInspector.PowerDispatcher.prototype={dataAvailable:function(events)
  3349. {for(var i=0;i<events.length;++i)
  3350. this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.EventTypes.PowerEventRecorded,events[i]);}}
  3351. WebInspector.powerProfiler;;WebInspector.TracingManager=function()
  3352. {WebInspector.Object.call(this);this._active=false;this._eventBufferSize=0;this._eventsRetrieved=0;WebInspector.targetManager.observeTargets(this);}
  3353. WebInspector.TracingManager.Events={"RetrieveEventsProgress":"RetrieveEventsProgress","BufferUsage":"BufferUsage","TracingStarted":"TracingStarted","EventsCollected":"EventsCollected","TracingStopped":"TracingStopped","TracingComplete":"TracingComplete"}
  3354. WebInspector.TracingManager.EventPayload;WebInspector.TracingManager.prototype={targetAdded:function(target)
  3355. {if(this._target)
  3356. return;this._target=target;target.registerTracingDispatcher(new WebInspector.TracingDispatcher(this));},targetRemoved:function(target)
  3357. {if(this._target!==target)
  3358. return;delete this._target;},target:function()
  3359. {return this._target;},_bufferUsage:function(usage,eventCount,percentFull)
  3360. {this._eventBufferSize=eventCount;this.dispatchEventToListeners(WebInspector.TracingManager.Events.BufferUsage,usage||percentFull);},_eventsCollected:function(events)
  3361. {this.dispatchEventToListeners(WebInspector.TracingManager.Events.EventsCollected,events);this._eventsRetrieved+=events.length;if(!this._eventBufferSize)
  3362. return;if(this._eventsRetrieved>this._eventBufferSize)
  3363. this._eventsRetrieved=this._eventBufferSize;this.dispatchEventToListeners(WebInspector.TracingManager.Events.RetrieveEventsProgress,this._eventsRetrieved/this._eventBufferSize);},_tracingComplete:function()
  3364. {this._eventBufferSize=0;this._eventsRetrieved=0;this.dispatchEventToListeners(WebInspector.TracingManager.Events.TracingComplete);},start:function(categoryFilter,options,callback)
  3365. {if(this._active)
  3366. return;WebInspector.targetManager.suspendAllTargets();var bufferUsageReportingIntervalMs=500;TracingAgent.start(categoryFilter,options,bufferUsageReportingIntervalMs,callback);this._active=true;this.dispatchEventToListeners(WebInspector.TracingManager.Events.TracingStarted);},stop:function()
  3367. {if(!this._active)
  3368. return;TracingAgent.end(this._onStop.bind(this));WebInspector.targetManager.resumeAllTargets();},_onStop:function()
  3369. {if(!this._active)
  3370. return;this.dispatchEventToListeners(WebInspector.TracingManager.Events.TracingStopped);this._active=false;},__proto__:WebInspector.Object.prototype}
  3371. WebInspector.TracingDispatcher=function(tracingManager)
  3372. {this._tracingManager=tracingManager;}
  3373. WebInspector.TracingDispatcher.prototype={bufferUsage:function(usage,eventCount,percentFull)
  3374. {this._tracingManager._bufferUsage(usage,eventCount,percentFull);},dataCollected:function(data)
  3375. {this._tracingManager._eventsCollected(data);},tracingComplete:function()
  3376. {this._tracingManager._tracingComplete();}};WebInspector.WorkerManager=function(target,isMainFrontend)
  3377. {this._reset();target.registerWorkerDispatcher(new WebInspector.WorkerDispatcher(this));if(isMainFrontend){target.workerAgent().enable();target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);}}
  3378. WebInspector.WorkerManager.Events={WorkerAdded:"WorkerAdded",WorkerRemoved:"WorkerRemoved",WorkersCleared:"WorkersCleared",WorkerSelectionChanged:"WorkerSelectionChanged",WorkerDisconnected:"WorkerDisconnected",MessageFromWorker:"MessageFromWorker",}
  3379. WebInspector.WorkerManager.MainThreadId=0;WebInspector.WorkerManager.prototype={_reset:function()
  3380. {this._threadUrlByThreadId={};this._threadUrlByThreadId[WebInspector.WorkerManager.MainThreadId]=WebInspector.UIString("Thread: Main");this._threadsList=[WebInspector.WorkerManager.MainThreadId];this._selectedThreadId=WebInspector.WorkerManager.MainThreadId;},_workerCreated:function(workerId,url,inspectorConnected)
  3381. {this._threadsList.push(workerId);this._threadUrlByThreadId[workerId]=url;this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkerAdded,{workerId:workerId,url:url,inspectorConnected:inspectorConnected});},_workerTerminated:function(workerId)
  3382. {this._threadsList.remove(workerId);delete this._threadUrlByThreadId[workerId];this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkerRemoved,workerId);},_dispatchMessageFromWorker:function(workerId,message)
  3383. {this.dispatchEventToListeners(WebInspector.WorkerManager.Events.MessageFromWorker,{workerId:workerId,message:message});},_disconnectedFromWorker:function()
  3384. {this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkerDisconnected);},_mainFrameNavigated:function(event)
  3385. {this._reset();this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkersCleared);},threadsList:function()
  3386. {return this._threadsList;},threadUrl:function(threadId)
  3387. {return this._threadUrlByThreadId[threadId];},setSelectedThreadId:function(threadId)
  3388. {this._selectedThreadId=threadId;},selectedThreadId:function()
  3389. {return this._selectedThreadId;},__proto__:WebInspector.Object.prototype}
  3390. WebInspector.WorkerDispatcher=function(workerManager)
  3391. {this._workerManager=workerManager;}
  3392. WebInspector.WorkerDispatcher.prototype={workerCreated:function(workerId,url,inspectorConnected)
  3393. {this._workerManager._workerCreated(workerId,url,inspectorConnected);},workerTerminated:function(workerId)
  3394. {this._workerManager._workerTerminated(workerId);},dispatchMessageFromWorker:function(workerId,message)
  3395. {this._workerManager._dispatchMessageFromWorker(workerId,message);},disconnectedFromWorker:function()
  3396. {this._workerManager._disconnectedFromWorker();}}
  3397. WebInspector.workerManager;;WebInspector.WorkerTargetManager=function(mainTarget,targetManager)
  3398. {this._mainTarget=mainTarget;this._targetManager=targetManager;this._targetsByWorkerId=new Map();mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerAdded,this._onWorkerAdded,this);mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerRemoved,this._onWorkerRemoved,this);mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkersCleared,this._onWorkersCleared,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.SuspendStateChanged,this._onSuspendStateChanged,this);this._onSuspendStateChanged();this._lastAnonymousTargetId=0;this._shouldPauseWorkerOnStart=WebInspector.isWorkerFrontend();}
  3399. WebInspector.WorkerTargetManager.prototype={_onSuspendStateChanged:function()
  3400. {var suspended=WebInspector.targetManager.allTargetsSuspended();this._mainTarget.workerAgent().setAutoconnectToWorkers(!suspended);},_onWorkerAdded:function(event)
  3401. {var data=(event.data);new WebInspector.WorkerConnection(this._mainTarget,data.workerId,data.inspectorConnected,onConnectionReady.bind(this,data.workerId));function onConnectionReady(workerId,connection)
  3402. {var parsedURL=data.url.asParsedURL();var workerName=parsedURL?parsedURL.lastPathComponent:"#"+(++this._lastAnonymousTargetId);this._targetManager.createTarget(WebInspector.UIString("Worker %s",workerName),connection,targetCreated.bind(this,workerId));}
  3403. function targetCreated(workerId,target)
  3404. {if(!target)
  3405. return;if(workerId)
  3406. this._targetsByWorkerId.set(workerId,target);if(data.inspectorConnected){if(this._shouldPauseWorkerOnStart)
  3407. target.debuggerAgent().pause();target.runtimeAgent().run(calculateTitle.bind(this,target));}else{calculateTitle.call(this,target);}
  3408. this._shouldPauseWorkerOnStart=false;}
  3409. function calculateTitle(target)
  3410. {if(!WebInspector.isWorkerFrontend())
  3411. return;this._calculateWorkerInspectorTitle(target);}},_calculateWorkerInspectorTitle:function(target)
  3412. {var expression="location.href";expression+=" + (this.name ? ' (' + this.name + ')' : '')";target.runtimeAgent().invoke_evaluate({expression:expression,doNotPauseOnExceptionsAndMuteConsole:true,returnByValue:true},evalCallback);function evalCallback(error,result,wasThrown)
  3413. {if(error||wasThrown){console.error(error);return;}
  3414. InspectorFrontendHost.inspectedURLChanged(String(result.value));}},_onWorkersCleared:function()
  3415. {this._lastAnonymousTargetId=0;this._targetsByWorkerId.clear();},_onWorkerRemoved:function(event)
  3416. {var workerId=(event.data);this._targetsByWorkerId.delete(workerId);},targetByWorkerId:function(workerId)
  3417. {return this._targetsByWorkerId.get(workerId)||null;}}
  3418. WebInspector.WorkerConnection=function(target,workerId,inspectorConnected,onConnectionReady)
  3419. {InspectorBackendClass.Connection.call(this);this.suppressErrorsForDomains(["Worker","Page","CSS","DOM","DOMStorage","Database","Network","IndexedDB","ServiceWorkerCache"]);this._target=target;this._workerId=workerId;this._workerAgent=target.workerAgent();target.workerManager.addEventListener(WebInspector.WorkerManager.Events.MessageFromWorker,this._dispatchMessageFromWorker,this);target.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerRemoved,this._onWorkerRemoved,this);target.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkersCleared,this._close,this);if(!inspectorConnected)
  3420. this._workerAgent.connectToWorker(workerId,onConnectionReady.bind(null,this));else
  3421. onConnectionReady.call(null,this);}
  3422. WebInspector.WorkerConnection.prototype={_dispatchMessageFromWorker:function(event)
  3423. {var data=(event.data);if(data.workerId===this._workerId)
  3424. this.dispatch(data.message);},sendMessage:function(messageObject)
  3425. {this._workerAgent.sendMessageToWorker(this._workerId,messageObject);},_onWorkerRemoved:function(event)
  3426. {var workerId=(event.data);if(workerId===this._workerId)
  3427. this._close();},_close:function()
  3428. {this._target.workerManager.removeEventListener(WebInspector.WorkerManager.Events.MessageFromWorker,this._dispatchMessageFromWorker,this);this._target.workerManager.removeEventListener(WebInspector.WorkerManager.Events.WorkerRemoved,this._onWorkerRemoved,this);this._target.workerManager.removeEventListener(WebInspector.WorkerManager.Events.WorkersCleared,this._close,this);this.connectionClosed("worker_terminated");},__proto__:InspectorBackendClass.Connection.prototype}
  3429. WebInspector.workerTargetManager;;WebInspector.RuntimeModel=function(target)
  3430. {WebInspector.SDKModel.call(this,WebInspector.RuntimeModel,target);this._debuggerModel=target.debuggerModel;this._agent=target.runtimeAgent();this.target().registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(this));this._agent.enable();this._executionContextById={};if(!Runtime.experiments.isEnabled("customObjectFormatters"))
  3431. return;if(WebInspector.settings.enableCustomFormatters.get())
  3432. this._agent.setCustomObjectFormatterEnabled(true);WebInspector.settings.enableCustomFormatters.addChangeListener(this._enableCustomFormattersStateChanged.bind(this));}
  3433. WebInspector.RuntimeModel.Events={ExecutionContextCreated:"ExecutionContextCreated",ExecutionContextDestroyed:"ExecutionContextDestroyed",}
  3434. WebInspector.RuntimeModel._privateScript="private script";WebInspector.RuntimeModel.prototype={executionContexts:function()
  3435. {return Object.values(this._executionContextById);},_executionContextCreated:function(context)
  3436. {if(context.name==WebInspector.RuntimeModel._privateScript&&!context.origin&&!Runtime.experiments.isEnabled("privateScriptInspection")){return;}
  3437. var executionContext=new WebInspector.ExecutionContext(this.target(),context.id,context.name,context.origin,context.isPageContext,context.frameId);this._executionContextById[executionContext.id]=executionContext;this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.ExecutionContextCreated,executionContext);},_executionContextDestroyed:function(executionContextId)
  3438. {var executionContext=this._executionContextById[executionContextId];if(!executionContext)
  3439. return;delete this._executionContextById[executionContextId];this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.ExecutionContextDestroyed,executionContext);},_executionContextsCleared:function()
  3440. {var contexts=this.executionContexts();this._executionContextById={};for(var i=0;i<contexts.length;++i)
  3441. this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.ExecutionContextDestroyed,contexts[i]);},createRemoteObject:function(payload)
  3442. {console.assert(typeof payload==="object","Remote object payload should only be an object");return new WebInspector.RemoteObjectImpl(this.target(),payload.objectId,payload.type,payload.subtype,payload.value,payload.description,payload.preview,payload.customPreview);},createScopeRemoteObject:function(payload,scopeRef)
  3443. {return new WebInspector.ScopeRemoteObject(this.target(),payload.objectId,scopeRef,payload.type,payload.subtype,payload.value,payload.description,payload.preview);},createRemoteObjectFromPrimitiveValue:function(value)
  3444. {return new WebInspector.RemoteObjectImpl(this.target(),undefined,typeof value,undefined,value);},createRemotePropertyFromPrimitiveValue:function(name,value)
  3445. {return new WebInspector.RemoteObjectProperty(name,this.createRemoteObjectFromPrimitiveValue(value));},_enableCustomFormattersStateChanged:function(event)
  3446. {var enabled=(event.data);this._agent.setCustomObjectFormatterEnabled(enabled);},__proto__:WebInspector.SDKModel.prototype}
  3447. WebInspector.RuntimeDispatcher=function(runtimeModel)
  3448. {this._runtimeModel=runtimeModel;}
  3449. WebInspector.RuntimeDispatcher.prototype={executionContextCreated:function(context)
  3450. {this._runtimeModel._executionContextCreated(context);},executionContextDestroyed:function(executionContextId)
  3451. {this._runtimeModel._executionContextDestroyed(executionContextId);},executionContextsCleared:function()
  3452. {this._runtimeModel._executionContextsCleared();}}
  3453. WebInspector.ExecutionContext=function(target,id,name,origin,isPageContext,frameId)
  3454. {WebInspector.SDKObject.call(this,target);this.id=id;this.name=name;this.origin=origin;this.isMainWorldContext=isPageContext;this._debuggerModel=target.debuggerModel;this.frameId=frameId;}
  3455. WebInspector.ExecutionContext.comparator=function(a,b)
  3456. {if(a.isMainWorldContext)
  3457. return-1;if(b.isMainWorldContext)
  3458. return+1;return a.name.localeCompare(b.name);}
  3459. WebInspector.ExecutionContext.prototype={evaluate:function(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
  3460. {if(this._debuggerModel.selectedCallFrame()){this._debuggerModel.evaluateOnSelectedCallFrame(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback);return;}
  3461. this._evaluateGlobal.apply(this,arguments);},globalObject:function(objectGroup,returnByValue,generatePreview,callback)
  3462. {this._evaluateGlobal("this",objectGroup,false,true,returnByValue,generatePreview,callback);},_evaluateGlobal:function(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
  3463. {if(!expression){expression="this";}
  3464. function evalCallback(error,result,wasThrown,exceptionDetails)
  3465. {if(error){callback(null,false);return;}
  3466. if(returnByValue)
  3467. callback(null,!!wasThrown,wasThrown?null:result,exceptionDetails);else
  3468. callback(this.target().runtimeModel.createRemoteObject(result),!!wasThrown,undefined,exceptionDetails);}
  3469. this.target().runtimeAgent().evaluate(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,this.id,returnByValue,generatePreview,evalCallback.bind(this));},completionsForExpression:function(expressionString,prefix,force,completionsReadyCallback)
  3470. {var lastIndex=expressionString.length-1;var dotNotation=(expressionString[lastIndex]===".");var bracketNotation=(expressionString[lastIndex]==="[");if(dotNotation||bracketNotation)
  3471. expressionString=expressionString.substr(0,lastIndex);if(expressionString&&parseInt(expressionString,10)==expressionString){completionsReadyCallback([]);return;}
  3472. if(!prefix&&!expressionString&&!force){completionsReadyCallback([]);return;}
  3473. if(!expressionString&&this._debuggerModel.selectedCallFrame())
  3474. this._debuggerModel.getSelectedCallFrameVariables(receivedPropertyNames.bind(this));else
  3475. this.evaluate(expressionString,"completion",true,true,false,false,evaluated.bind(this));function evaluated(result,wasThrown)
  3476. {if(!result||wasThrown){completionsReadyCallback([]);return;}
  3477. function getCompletions(type)
  3478. {var object;if(type==="string")
  3479. object=new String("");else if(type==="number")
  3480. object=new Number(0);else if(type==="boolean")
  3481. object=new Boolean(false);else
  3482. object=this;var resultSet={};for(var o=object;o;o=o.__proto__){try{if(type==="array"&&o===object&&ArrayBuffer.isView(o)&&o.length>9999)
  3483. continue;var names=Object.getOwnPropertyNames(o);for(var i=0;i<names.length;++i)
  3484. resultSet[names[i]]=true;}catch(e){}}
  3485. return resultSet;}
  3486. if(result.type==="object"||result.type==="function")
  3487. result.callFunctionJSON(getCompletions,[WebInspector.RemoteObject.toCallArgument(result.subtype)],receivedPropertyNames.bind(this));else if(result.type==="string"||result.type==="number"||result.type==="boolean")
  3488. this.evaluate("("+getCompletions+")(\""+result.type+"\")","completion",false,true,true,false,receivedPropertyNamesFromEval.bind(this));}
  3489. function receivedPropertyNamesFromEval(notRelevant,wasThrown,result)
  3490. {if(result&&!wasThrown)
  3491. receivedPropertyNames.call(this,result.value);else
  3492. completionsReadyCallback([]);}
  3493. function receivedPropertyNames(propertyNames)
  3494. {this.target().runtimeAgent().releaseObjectGroup("completion");if(!propertyNames){completionsReadyCallback([]);return;}
  3495. var includeCommandLineAPI=(!dotNotation&&!bracketNotation);if(includeCommandLineAPI){const commandLineAPI=["dir","dirxml","keys","values","profile","profileEnd","monitorEvents","unmonitorEvents","inspect","copy","clear","getEventListeners","debug","undebug","monitor","unmonitor","table","$","$$","$x"];for(var i=0;i<commandLineAPI.length;++i)
  3496. propertyNames[commandLineAPI[i]]=true;}
  3497. this._reportCompletions(completionsReadyCallback,dotNotation,bracketNotation,expressionString,prefix,Object.keys(propertyNames));}},_reportCompletions:function(completionsReadyCallback,dotNotation,bracketNotation,expressionString,prefix,properties){if(bracketNotation){if(prefix.length&&prefix[0]==="'")
  3498. var quoteUsed="'";else
  3499. var quoteUsed="\"";}
  3500. var results=[];if(!expressionString){const keywords=["break","case","catch","continue","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","this","throw","try","typeof","var","void","while","with"];properties=properties.concat(keywords);}
  3501. properties.sort();for(var i=0;i<properties.length;++i){var property=properties[i];if(dotNotation&&!/^[a-zA-Z_$\u008F-\uFFFF][a-zA-Z0-9_$\u008F-\uFFFF]*$/.test(property))
  3502. continue;if(bracketNotation){if(!/^[0-9]+$/.test(property))
  3503. property=quoteUsed+property.escapeCharacters(quoteUsed+"\\")+quoteUsed;property+="]";}
  3504. if(property.length<prefix.length)
  3505. continue;if(prefix.length&&!property.startsWith(prefix))
  3506. continue;results.push(property);}
  3507. completionsReadyCallback(results);},__proto__:WebInspector.SDKObject.prototype}
  3508. WebInspector.runtimeModel;;WebInspector.Script=function(target,scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL,contextData)
  3509. {WebInspector.SDKObject.call(this,target);this.scriptId=scriptId;this.sourceURL=sourceURL;this.lineOffset=startLine;this.columnOffset=startColumn;this.endLine=endLine;this.endColumn=endColumn;this._isContentScript=isContentScript;this.sourceMapURL=sourceMapURL;this.hasSourceURL=hasSourceURL;this._contextData=contextData;}
  3510. WebInspector.Script.Events={ScriptEdited:"ScriptEdited",SourceMapURLAdded:"SourceMapURLAdded",}
  3511. WebInspector.Script.snippetSourceURLPrefix="snippets:///";WebInspector.Script.sourceURLRegex=/\n[\040\t]*\/\/[@#]\ssourceURL=\s*(\S*?)\s*$/mg;WebInspector.Script._trimSourceURLComment=function(source)
  3512. {return source.replace(WebInspector.Script.sourceURLRegex,"");}
  3513. WebInspector.Script.prototype={isContentScript:function()
  3514. {return this._isContentScript;},contentURL:function()
  3515. {return this.sourceURL;},contentType:function()
  3516. {return WebInspector.resourceTypes.Script;},requestContent:function(callback)
  3517. {if(this._source){callback(this._source);return;}
  3518. function didGetScriptSource(error,source)
  3519. {this._source=WebInspector.Script._trimSourceURLComment(error?"":source);callback(this._source);}
  3520. if(this.scriptId){this.target().debuggerAgent().getScriptSource(this.scriptId,didGetScriptSource.bind(this));}else
  3521. callback("");},searchInContent:function(query,caseSensitive,isRegex,callback)
  3522. {function innerCallback(error,searchMatches)
  3523. {if(error)
  3524. console.error(error);var result=[];for(var i=0;i<searchMatches.length;++i){var searchMatch=new WebInspector.ContentProvider.SearchMatch(searchMatches[i].lineNumber,searchMatches[i].lineContent);result.push(searchMatch);}
  3525. callback(result||[]);}
  3526. if(this.scriptId){this.target().debuggerAgent().searchInContent(this.scriptId,query,caseSensitive,isRegex,innerCallback);}else{callback([]);}},_appendSourceURLCommentIfNeeded:function(source)
  3527. {if(!this.hasSourceURL)
  3528. return source;return source+"\n //# sourceURL="+this.sourceURL;},editSource:function(newSource,callback)
  3529. {function didEditScriptSource(error,errorData,callFrames,debugData,asyncStackTrace)
  3530. {if(!error)
  3531. this._source=newSource;var needsStepIn=!!debugData&&debugData["stack_update_needs_step_in"]===true;callback(error,errorData,callFrames,asyncStackTrace,needsStepIn);if(!error)
  3532. this.dispatchEventToListeners(WebInspector.Script.Events.ScriptEdited,newSource);}
  3533. newSource=WebInspector.Script._trimSourceURLComment(newSource);newSource=this._appendSourceURLCommentIfNeeded(newSource);if(this.scriptId)
  3534. this.target().debuggerAgent().setScriptSource(this.scriptId,newSource,undefined,didEditScriptSource.bind(this));else
  3535. callback("Script failed to parse");},rawLocation:function(lineNumber,columnNumber)
  3536. {return new WebInspector.DebuggerModel.Location(this.target(),this.scriptId,lineNumber,columnNumber||0);},isInlineScript:function()
  3537. {var startsAtZero=!this.lineOffset&&!this.columnOffset;return!!this.sourceURL&&!startsAtZero;},addSourceMapURL:function(sourceMapURL)
  3538. {if(this.sourceMapURL)
  3539. return;this.sourceMapURL=sourceMapURL;this.dispatchEventToListeners(WebInspector.Script.Events.SourceMapURLAdded,this.sourceMapURL);},isAnonymousScript:function()
  3540. {return!this.sourceURL;},isSnippet:function()
  3541. {return!!this.sourceURL&&this.sourceURL.startsWith(WebInspector.Script.snippetSourceURLPrefix);},isInlineScriptWithSourceURL:function()
  3542. {return!!this.hasSourceURL&&this.isInlineScript();},__proto__:WebInspector.SDKObject.prototype};WebInspector.ServiceWorkerCacheModel=function(target)
  3543. {WebInspector.SDKModel.call(this,WebInspector.ServiceWorkerCacheModel,target);this._caches=new Map();this._cacheNames=new Set();this._agent=target.serviceWorkerCacheAgent();}
  3544. WebInspector.ServiceWorkerCacheModel.EventTypes={CacheAdded:"CacheAdded",CacheRemoved:"CacheRemoved",}
  3545. WebInspector.ServiceWorkerCacheModel.prototype={_reset:function()
  3546. {this._updateCacheNames([]);this._loadCacheNames();},refreshCacheNames:function()
  3547. {this._loadCacheNames();},deleteCache:function(cacheId)
  3548. {function callback(error)
  3549. {if(error){console.error("ServiceWorkerCacheAgent error: ",error);return;}
  3550. this._cacheRemoved(cacheId.name);}
  3551. this._agent.deleteCache(cacheId.name,callback.bind(this));},loadCacheData:function(cacheId,skipCount,pageSize,callback)
  3552. {this._requestEntries(cacheId,cacheId.name,skipCount,pageSize,callback);},caches:function()
  3553. {var result=[];for(var cacheName of this._cacheNames){result.push(new WebInspector.ServiceWorkerCacheModel.CacheId(cacheName));}
  3554. return result;},dispose:function()
  3555. {this._updateCacheNames([]);},_loadCacheNames:function()
  3556. {function callback(error,cacheNames)
  3557. {if(error){console.error("ServiceWorkerCacheAgent error: ",error);return;}
  3558. if(!this._cacheNames)
  3559. return;this._updateCacheNames(cacheNames);}
  3560. this._agent.requestCacheNames(callback.bind(this));},_updateCacheNames:function(cacheNames)
  3561. {var newCacheNames=new Set(cacheNames);var oldCacheNames=this._cacheNames;this._cacheNames=new Set(cacheNames);for(var oldCacheName of oldCacheNames){if(!newCacheNames[oldCacheName])
  3562. this._cacheRemoved(oldCacheName);}
  3563. for(var newCacheName of newCacheNames){if(!oldCacheNames[newCacheName])
  3564. this._cacheAdded(newCacheName);}},_cacheAdded:function(cacheName)
  3565. {var cacheId=new WebInspector.ServiceWorkerCacheModel.CacheId(cacheName);this.dispatchEventToListeners(WebInspector.ServiceWorkerCacheModel.EventTypes.CacheAdded,cacheId);},_cacheRemoved:function(cacheName)
  3566. {var cacheId=new WebInspector.ServiceWorkerCacheModel.CacheId(cacheName);this.dispatchEventToListeners(WebInspector.ServiceWorkerCacheModel.EventTypes.CacheRemoved,cacheId);},_requestEntries:function(cacheId,cacheName,skipCount,pageSize,callback)
  3567. {function innerCallback(error,dataEntries,hasMore)
  3568. {if(error){console.error("ServiceWorkerCacheAgent error: ",error);return;}
  3569. if(!this._cacheNames)
  3570. return;var entries=[];for(var i=0;i<dataEntries.length;++i){var request=WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].request));var response=WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].response));entries.push(new WebInspector.ServiceWorkerCacheModel.Entry(request,response));}
  3571. callback(entries,hasMore);}
  3572. this._agent.requestEntries(cacheName,skipCount,pageSize,innerCallback.bind(this));},__proto__:WebInspector.SDKModel.prototype}
  3573. WebInspector.ServiceWorkerCacheModel.Entry=function(request,response)
  3574. {this.request=request;this.response=response;}
  3575. WebInspector.ServiceWorkerCacheModel.CacheId=function(name)
  3576. {this.name=name;}
  3577. WebInspector.ServiceWorkerCacheModel.CacheId.prototype={equals:function(cacheId)
  3578. {return this.name===cacheId.name;}}
  3579. WebInspector.ServiceWorkerCacheModel.Cache=function(cacheId)
  3580. {this.cacheId=cacheId;};WebInspector.SnippetStorage=function(settingPrefix,namePrefix)
  3581. {this._snippets={};this._lastSnippetIdentifierSetting=WebInspector.settings.createSetting(settingPrefix+"Snippets_lastIdentifier",0);this._snippetsSetting=WebInspector.settings.createSetting(settingPrefix+"Snippets",[]);this._namePrefix=namePrefix;this._loadSettings();}
  3582. WebInspector.SnippetStorage.prototype={get namePrefix()
  3583. {return this._namePrefix;},_saveSettings:function()
  3584. {var savedSnippets=[];for(var id in this._snippets)
  3585. savedSnippets.push(this._snippets[id].serializeToObject());this._snippetsSetting.set(savedSnippets);},snippets:function()
  3586. {var result=[];for(var id in this._snippets)
  3587. result.push(this._snippets[id]);return result;},snippetForId:function(id)
  3588. {return this._snippets[id];},snippetForName:function(name)
  3589. {var snippets=Object.values(this._snippets);for(var i=0;i<snippets.length;++i)
  3590. if(snippets[i].name===name)
  3591. return snippets[i];return null;},_loadSettings:function()
  3592. {var savedSnippets=this._snippetsSetting.get();for(var i=0;i<savedSnippets.length;++i)
  3593. this._snippetAdded(WebInspector.Snippet.fromObject(this,savedSnippets[i]));},deleteSnippet:function(snippet)
  3594. {delete this._snippets[snippet.id];this._saveSettings();},createSnippet:function()
  3595. {var nextId=this._lastSnippetIdentifierSetting.get()+1;var snippetId=String(nextId);this._lastSnippetIdentifierSetting.set(nextId);var snippet=new WebInspector.Snippet(this,snippetId);this._snippetAdded(snippet);this._saveSettings();return snippet;},_snippetAdded:function(snippet)
  3596. {this._snippets[snippet.id]=snippet;},__proto__:WebInspector.Object.prototype}
  3597. WebInspector.Snippet=function(storage,id,name,content)
  3598. {this._storage=storage;this._id=id;this._name=name||storage.namePrefix+id;this._content=content||"";}
  3599. WebInspector.Snippet.fromObject=function(storage,serializedSnippet)
  3600. {return new WebInspector.Snippet(storage,serializedSnippet.id,serializedSnippet.name,serializedSnippet.content);}
  3601. WebInspector.Snippet.prototype={get id()
  3602. {return this._id;},get name()
  3603. {return this._name;},set name(name)
  3604. {if(this._name===name)
  3605. return;this._name=name;this._storage._saveSettings();},get content()
  3606. {return this._content;},set content(content)
  3607. {if(this._content===content)
  3608. return;this._content=content;this._storage._saveSettings();},serializeToObject:function()
  3609. {var serializedSnippet={};serializedSnippet.id=this.id;serializedSnippet.name=this.name;serializedSnippet.content=this.content;return serializedSnippet;},__proto__:WebInspector.Object.prototype};WebInspector.RemoteObject=function(){}
  3610. WebInspector.RemoteObject.prototype={customPreview:function()
  3611. {return null;},get type()
  3612. {throw"Not implemented";},get subtype()
  3613. {throw"Not implemented";},get description()
  3614. {throw"Not implemented";},get hasChildren()
  3615. {throw"Not implemented";},arrayLength:function()
  3616. {throw"Not implemented";},getOwnProperties:function(callback)
  3617. {throw"Not implemented";},getAllProperties:function(accessorPropertiesOnly,callback)
  3618. {throw"Not implemented";},deleteProperty:function(name,callback)
  3619. {throw"Not implemented";},callFunction:function(functionDeclaration,args,callback)
  3620. {throw"Not implemented";},callFunctionJSON:function(functionDeclaration,args,callback)
  3621. {throw"Not implemented";},target:function()
  3622. {throw new Error("Target-less object");},isNode:function()
  3623. {return false;},functionDetails:function(callback)
  3624. {callback(null);},generatorObjectDetails:function(callback)
  3625. {callback(null);},collectionEntries:function(callback)
  3626. {callback(null);}}
  3627. WebInspector.RemoteObject.fromLocalObject=function(value)
  3628. {return new WebInspector.LocalJSONObject(value);}
  3629. WebInspector.RemoteObject.type=function(remoteObject)
  3630. {if(remoteObject===null)
  3631. return"null";var type=typeof remoteObject;if(type!=="object"&&type!=="function")
  3632. return type;return remoteObject.type;}
  3633. WebInspector.RemoteObject.toCallArgument=function(object)
  3634. {var type=typeof object;var value=object;var objectId=undefined;var description=String(object);if(type==="number"&&value===0&&1/value<0)
  3635. description="-0";switch(type){case"number":case"string":case"boolean":case"undefined":break;default:if(object){type=object.type;value=object.value;objectId=object.objectId;description=object.description;}
  3636. break;}
  3637. if(type==="number"){switch(description){case"NaN":case"Infinity":case"-Infinity":case"-0":value=description;break;}}
  3638. return{value:value,objectId:objectId,type:(type)};}
  3639. WebInspector.RemoteObjectImpl=function(target,objectId,type,subtype,value,description,preview,customPreview)
  3640. {WebInspector.RemoteObject.call(this);this._target=target;this._runtimeAgent=target.runtimeAgent();this._domModel=target.domModel;this._type=type;this._subtype=subtype;if(objectId){this._objectId=objectId;this._description=description;this._hasChildren=(type!=="symbol");this._preview=preview;}else{console.assert(type!=="object"||value===null);this._description=description||(value+"");this._hasChildren=false;if(type==="number"&&typeof value!=="number")
  3641. this.value=Number(value);else
  3642. this.value=value;}
  3643. this._customPreview=customPreview||null;}
  3644. WebInspector.RemoteObjectImpl.prototype={customPreview:function()
  3645. {return this._customPreview;},get objectId()
  3646. {return this._objectId;},get type()
  3647. {return this._type;},get subtype()
  3648. {return this._subtype;},get description()
  3649. {return this._description;},get hasChildren()
  3650. {return this._hasChildren;},get preview()
  3651. {return this._preview;},getOwnProperties:function(callback)
  3652. {this.doGetProperties(true,false,callback);},getAllProperties:function(accessorPropertiesOnly,callback)
  3653. {this.doGetProperties(false,accessorPropertiesOnly,callback);},getProperty:function(propertyPath,callback)
  3654. {function remoteFunction(arrayStr)
  3655. {var result=this;var properties=JSON.parse(arrayStr);for(var i=0,n=properties.length;i<n;++i)
  3656. result=result[properties[i]];return result;}
  3657. var args=[{value:JSON.stringify(propertyPath)}];this.callFunction(remoteFunction,args,callback);},doGetProperties:function(ownProperties,accessorPropertiesOnly,callback)
  3658. {if(!this._objectId){callback(null,null);return;}
  3659. function remoteObjectBinder(error,properties,internalProperties)
  3660. {if(error){callback(null,null);return;}
  3661. var result=[];for(var i=0;properties&&i<properties.length;++i){var property=properties[i];var propertyValue=property.value?this._target.runtimeModel.createRemoteObject(property.value):null;var propertySymbol=property.symbol?this._target.runtimeModel.createRemoteObject(property.symbol):null;var remoteProperty=new WebInspector.RemoteObjectProperty(property.name,propertyValue,!!property.enumerable,!!property.writable,!!property.isOwn,!!property.wasThrown,propertySymbol);if(typeof property.value==="undefined"){if(property.get&&property.get.type!=="undefined")
  3662. remoteProperty.getter=this._target.runtimeModel.createRemoteObject(property.get);if(property.set&&property.set.type!=="undefined")
  3663. remoteProperty.setter=this._target.runtimeModel.createRemoteObject(property.set);}
  3664. result.push(remoteProperty);}
  3665. var internalPropertiesResult=null;if(internalProperties){internalPropertiesResult=[];for(var i=0;i<internalProperties.length;i++){var property=internalProperties[i];if(!property.value)
  3666. continue;var propertyValue=this._target.runtimeModel.createRemoteObject(property.value);internalPropertiesResult.push(new WebInspector.RemoteObjectProperty(property.name,propertyValue,true,false));}}
  3667. callback(result,internalPropertiesResult);}
  3668. this._runtimeAgent.getProperties(this._objectId,ownProperties,accessorPropertiesOnly,remoteObjectBinder.bind(this));},setPropertyValue:function(name,value,callback)
  3669. {if(!this._objectId){callback("Can't set a property of non-object.");return;}
  3670. this._runtimeAgent.invoke_evaluate({expression:value,doNotPauseOnExceptionsAndMuteConsole:true},evaluatedCallback.bind(this));function evaluatedCallback(error,result,wasThrown)
  3671. {if(error||wasThrown){callback(error||result.description);return;}
  3672. if(typeof name==="string")
  3673. name=WebInspector.RemoteObject.toCallArgument(name);this.doSetObjectPropertyValue(result,name,callback);if(result.objectId)
  3674. this._runtimeAgent.releaseObject(result.objectId);}},doSetObjectPropertyValue:function(result,name,callback)
  3675. {var setPropertyValueFunction="function(a, b) { this[a] = b; }";var argv=[name,WebInspector.RemoteObject.toCallArgument(result)];this._runtimeAgent.callFunctionOn(this._objectId,setPropertyValueFunction,argv,true,undefined,undefined,propertySetCallback);function propertySetCallback(error,result,wasThrown)
  3676. {if(error||wasThrown){callback(error||result.description);return;}
  3677. callback();}},deleteProperty:function(name,callback)
  3678. {if(!this._objectId){callback("Can't delete a property of non-object.");return;}
  3679. var deletePropertyFunction="function(a) { delete this[a]; return !(a in this); }";this._runtimeAgent.callFunctionOn(this._objectId,deletePropertyFunction,[name],true,undefined,undefined,deletePropertyCallback);function deletePropertyCallback(error,result,wasThrown)
  3680. {if(error||wasThrown){callback(error||result.description);return;}
  3681. if(!result.value)
  3682. callback("Failed to delete property.");else
  3683. callback();}},pushNodeToFrontend:function(callback)
  3684. {if(this.isNode())
  3685. this._domModel.pushNodeToFrontend(this._objectId,callback);else
  3686. callback(null);},highlightAsDOMNode:function()
  3687. {this._domModel.highlightDOMNode(undefined,undefined,this._objectId);},hideDOMNodeHighlight:function()
  3688. {this._domModel.hideDOMNodeHighlight();},callFunction:function(functionDeclaration,args,callback)
  3689. {function mycallback(error,result,wasThrown)
  3690. {if(!callback)
  3691. return;if(error)
  3692. callback(null,false);else
  3693. callback(this.target().runtimeModel.createRemoteObject(result),wasThrown);}
  3694. this._runtimeAgent.callFunctionOn(this._objectId,functionDeclaration.toString(),args,true,undefined,undefined,mycallback.bind(this));},callFunctionJSON:function(functionDeclaration,args,callback)
  3695. {function mycallback(error,result,wasThrown)
  3696. {callback((error||wasThrown)?null:result.value);}
  3697. this._runtimeAgent.callFunctionOn(this._objectId,functionDeclaration.toString(),args,true,true,false,mycallback);},release:function()
  3698. {if(!this._objectId)
  3699. return;this._runtimeAgent.releaseObject(this._objectId);},arrayLength:function()
  3700. {if(this.subtype!=="array")
  3701. return 0;var matches=this._description.match(/\[([0-9]+)\]/);if(!matches)
  3702. return 0;return parseInt(matches[1],10);},target:function()
  3703. {return this._target;},isNode:function()
  3704. {return!!this._objectId&&this.type==="object"&&this.subtype==="node";},functionDetails:function(callback)
  3705. {this._target.debuggerModel.functionDetails(this,callback);},generatorObjectDetails:function(callback)
  3706. {this._target.debuggerModel.generatorObjectDetails(this,callback);},collectionEntries:function(callback)
  3707. {if(!this._objectId){callback(null);return;}
  3708. this._target.debuggerAgent().getCollectionEntries(this._objectId,didGetCollectionEntries);function didGetCollectionEntries(error,response)
  3709. {if(error){console.error(error);callback(null);return;}
  3710. callback(response);}},__proto__:WebInspector.RemoteObject.prototype};WebInspector.RemoteObject.loadFromObject=function(object,flattenProtoChain,callback)
  3711. {if(flattenProtoChain)
  3712. object.getAllProperties(false,callback);else
  3713. WebInspector.RemoteObject.loadFromObjectPerProto(object,callback);};WebInspector.RemoteObject.loadFromObjectPerProto=function(object,callback)
  3714. {var savedOwnProperties;var savedAccessorProperties;var savedInternalProperties;var resultCounter=2;function processCallback()
  3715. {if(--resultCounter)
  3716. return;if(savedOwnProperties&&savedAccessorProperties){var combinedList=savedAccessorProperties.slice(0);for(var i=0;i<savedOwnProperties.length;i++){var property=savedOwnProperties[i];if(!property.isAccessorProperty())
  3717. combinedList.push(property);}
  3718. return callback(combinedList,savedInternalProperties?savedInternalProperties:null);}else{callback(null,null);}}
  3719. function allAccessorPropertiesCallback(properties,internalProperties)
  3720. {savedAccessorProperties=properties;processCallback();}
  3721. function ownPropertiesCallback(properties,internalProperties)
  3722. {savedOwnProperties=properties;savedInternalProperties=internalProperties;processCallback();}
  3723. object.getAllProperties(true,allAccessorPropertiesCallback);object.getOwnProperties(ownPropertiesCallback);};WebInspector.ScopeRemoteObject=function(target,objectId,scopeRef,type,subtype,value,description,preview)
  3724. {WebInspector.RemoteObjectImpl.call(this,target,objectId,type,subtype,value,description,preview);this._scopeRef=scopeRef;this._savedScopeProperties=undefined;this._debuggerAgent=target.debuggerAgent();};WebInspector.ScopeRemoteObject.prototype={doGetProperties:function(ownProperties,accessorPropertiesOnly,callback)
  3725. {if(accessorPropertiesOnly){callback([],[]);return;}
  3726. if(this._savedScopeProperties){callback(this._savedScopeProperties.slice(),[]);return;}
  3727. function wrappedCallback(properties,internalProperties)
  3728. {if(this._scopeRef&&Array.isArray(properties))
  3729. this._savedScopeProperties=properties.slice();callback(properties,internalProperties);}
  3730. WebInspector.RemoteObjectImpl.prototype.doGetProperties.call(this,ownProperties,accessorPropertiesOnly,wrappedCallback.bind(this));},doSetObjectPropertyValue:function(result,name,callback)
  3731. {this._debuggerAgent.setVariableValue(this._scopeRef.number,(name.value),WebInspector.RemoteObject.toCallArgument(result),this._scopeRef.callFrameId,this._scopeRef.functionId,setVariableValueCallback.bind(this));function setVariableValueCallback(error)
  3732. {if(error){callback(error);return;}
  3733. if(this._savedScopeProperties){for(var i=0;i<this._savedScopeProperties.length;i++){if(this._savedScopeProperties[i].name===name)
  3734. this._savedScopeProperties[i].value=this._target.runtimeModel.createRemoteObject(result);}}
  3735. callback();}},__proto__:WebInspector.RemoteObjectImpl.prototype};WebInspector.ScopeRef=function(number,callFrameId,functionId)
  3736. {this.number=number;this.callFrameId=callFrameId;this.functionId=functionId;}
  3737. WebInspector.RemoteObjectProperty=function(name,value,enumerable,writable,isOwn,wasThrown,symbol)
  3738. {this.name=name;if(value!==null)
  3739. this.value=value;this.enumerable=typeof enumerable!=="undefined"?enumerable:true;this.writable=typeof writable!=="undefined"?writable:true;this.isOwn=!!isOwn;this.wasThrown=!!wasThrown;if(symbol)
  3740. this.symbol=symbol;}
  3741. WebInspector.RemoteObjectProperty.prototype={isAccessorProperty:function()
  3742. {return!!(this.getter||this.setter);}};WebInspector.LocalJSONObject=function(value)
  3743. {WebInspector.RemoteObject.call(this);this._value=value;}
  3744. WebInspector.LocalJSONObject.prototype={get description()
  3745. {if(this._cachedDescription)
  3746. return this._cachedDescription;function formatArrayItem(property)
  3747. {return this._formatValue(property.value);}
  3748. function formatObjectItem(property)
  3749. {var name=property.name;if(/^\s|\s$|^$|\n/.test(name))
  3750. name="\""+name.replace(/\n/g,"\u21B5")+"\"";return name+": "+this._formatValue(property.value);}
  3751. if(this.type==="object"){switch(this.subtype){case"array":this._cachedDescription=this._concatenate("[","]",formatArrayItem.bind(this));break;case"date":this._cachedDescription=""+this._value;break;case"null":this._cachedDescription="null";break;default:this._cachedDescription=this._concatenate("{","}",formatObjectItem.bind(this));}}else{this._cachedDescription=String(this._value);}
  3752. return this._cachedDescription;},_formatValue:function(value)
  3753. {if(!value)
  3754. return"undefined";var description=value.description||"";if(value.type==="string")
  3755. return"\""+description.replace(/\n/g,"\u21B5")+"\"";return description;},_concatenate:function(prefix,suffix,formatProperty)
  3756. {var previewChars=100;var buffer=prefix;var children=this._children();for(var i=0;i<children.length;++i){var itemDescription=formatProperty(children[i]);if(buffer.length+itemDescription.length>previewChars){buffer+=",\u2026";break;}
  3757. if(i)
  3758. buffer+=", ";buffer+=itemDescription;}
  3759. buffer+=suffix;return buffer;},get type()
  3760. {return typeof this._value;},get subtype()
  3761. {if(this._value===null)
  3762. return"null";if(Array.isArray(this._value))
  3763. return"array";if(this._value instanceof Date)
  3764. return"date";return undefined;},get hasChildren()
  3765. {if((typeof this._value!=="object")||(this._value===null))
  3766. return false;return!!Object.keys((this._value)).length;},getOwnProperties:function(callback)
  3767. {callback(this._children(),null);},getAllProperties:function(accessorPropertiesOnly,callback)
  3768. {if(accessorPropertiesOnly)
  3769. callback([],null);else
  3770. callback(this._children(),null);},_children:function()
  3771. {if(!this.hasChildren)
  3772. return[];var value=(this._value);function buildProperty(propName)
  3773. {var propValue=value[propName];if(!(propValue instanceof WebInspector.RemoteObject))
  3774. propValue=WebInspector.RemoteObject.fromLocalObject(propValue);return new WebInspector.RemoteObjectProperty(propName,propValue);}
  3775. if(!this._cachedChildren)
  3776. this._cachedChildren=Object.keys(value).map(buildProperty);return this._cachedChildren;},isError:function()
  3777. {return false;},arrayLength:function()
  3778. {return Array.isArray(this._value)?this._value.length:0;},callFunction:function(functionDeclaration,args,callback)
  3779. {var target=(this._value);var rawArgs=args?args.map(function(arg){return arg.value;}):[];var result;var wasThrown=false;try{result=functionDeclaration.apply(target,rawArgs);}catch(e){wasThrown=true;}
  3780. if(!callback)
  3781. return;callback(WebInspector.RemoteObject.fromLocalObject(result),wasThrown);},callFunctionJSON:function(functionDeclaration,args,callback)
  3782. {var target=(this._value);var rawArgs=args?args.map(function(arg){return arg.value;}):[];var result;try{result=functionDeclaration.apply(target,rawArgs);}catch(e){result=null;}
  3783. callback(result);},__proto__:WebInspector.RemoteObject.prototype}
  3784. WebInspector.MapEntryLocalJSONObject=function(value)
  3785. {WebInspector.LocalJSONObject.call(this,value);}
  3786. WebInspector.MapEntryLocalJSONObject.prototype={get description()
  3787. {if(!this._cachedDescription){var children=this._children();this._cachedDescription="{"+this._formatValue(children[0].value)+" => "+this._formatValue(children[1].value)+"}";}
  3788. return this._cachedDescription;},__proto__:WebInspector.LocalJSONObject.prototype};WebInspector.Resource=function(target,request,url,documentURL,frameId,loaderId,type,mimeType,isHidden)
  3789. {WebInspector.SDKObject.call(this,target);this._request=request;this.url=url;this._documentURL=documentURL;this._frameId=frameId;this._loaderId=loaderId;this._type=type||WebInspector.resourceTypes.Other;this._mimeType=mimeType;this._isHidden=isHidden;this._content;this._contentEncoded;this._pendingContentCallbacks=[];if(this._request&&!this._request.finished)
  3790. this._request.addEventListener(WebInspector.NetworkRequest.Events.FinishedLoading,this._requestFinished,this);}
  3791. WebInspector.Resource.Events={MessageAdded:"message-added",MessagesCleared:"messages-cleared",}
  3792. WebInspector.Resource.contentAsDataURL=function(content,mimeType,contentEncoded)
  3793. {const maxDataUrlSize=1024*1024;if(content===null||content.length>maxDataUrlSize)
  3794. return null;return"data:"+mimeType+(contentEncoded?";base64,":",")+content;}
  3795. WebInspector.Resource.populateImageSource=function(url,mimeType,contentProvider,image)
  3796. {function onResourceContent(content)
  3797. {var imageSrc=WebInspector.Resource.contentAsDataURL(content,mimeType,true);if(imageSrc===null)
  3798. imageSrc=url;image.src=imageSrc;}
  3799. contentProvider.requestContent(onResourceContent);}
  3800. WebInspector.Resource.prototype={get request()
  3801. {return this._request;},get url()
  3802. {return this._url;},set url(x)
  3803. {this._url=x;this._parsedURL=new WebInspector.ParsedURL(x);},get parsedURL()
  3804. {return this._parsedURL;},get documentURL()
  3805. {return this._documentURL;},get frameId()
  3806. {return this._frameId;},get loaderId()
  3807. {return this._loaderId;},get displayName()
  3808. {return this._parsedURL.displayName;},resourceType:function()
  3809. {return this._request?this._request.resourceType():this._type;},get mimeType()
  3810. {return this._request?this._request.mimeType:this._mimeType;},get messages()
  3811. {return this._messages||[];},addMessage:function(msg)
  3812. {if(!msg.isErrorOrWarning()||!msg.messageText)
  3813. return;if(!this._messages)
  3814. this._messages=[];this._messages.push(msg);this.dispatchEventToListeners(WebInspector.Resource.Events.MessageAdded,msg);},get errors()
  3815. {return this._errors||0;},set errors(x)
  3816. {this._errors=x;},get warnings()
  3817. {return this._warnings||0;},set warnings(x)
  3818. {this._warnings=x;},clearErrorsAndWarnings:function()
  3819. {this._messages=[];this._warnings=0;this._errors=0;this.dispatchEventToListeners(WebInspector.Resource.Events.MessagesCleared);},get content()
  3820. {return this._content;},get contentEncoded()
  3821. {return this._contentEncoded;},contentURL:function()
  3822. {return this._url;},contentType:function()
  3823. {return this.resourceType();},requestContent:function(callback)
  3824. {if(typeof this._content!=="undefined"){callback(this._content);return;}
  3825. this._pendingContentCallbacks.push(callback);if(!this._request||this._request.finished)
  3826. this._innerRequestContent();},canonicalMimeType:function()
  3827. {return this.resourceType().canonicalMimeType()||this.mimeType;},searchInContent:function(query,caseSensitive,isRegex,callback)
  3828. {function callbackWrapper(error,searchMatches)
  3829. {callback(searchMatches||[]);}
  3830. if(this.resourceType()===WebInspector.resourceTypes.Document){callback([]);return;}
  3831. if(this.frameId)
  3832. this.target().pageAgent().searchInResource(this.frameId,this.url,query,caseSensitive,isRegex,callbackWrapper);else
  3833. callback([]);},populateImageSource:function(image)
  3834. {WebInspector.Resource.populateImageSource(this._url,this._mimeType,this,image);},_requestFinished:function()
  3835. {this._request.removeEventListener(WebInspector.NetworkRequest.Events.FinishedLoading,this._requestFinished,this);if(this._pendingContentCallbacks.length)
  3836. this._innerRequestContent();},_innerRequestContent:function()
  3837. {if(this._contentRequested)
  3838. return;this._contentRequested=true;function contentLoaded(error,content,contentEncoded)
  3839. {if(error||content===null){replyWithContent.call(this,null,false);return;}
  3840. replyWithContent.call(this,content,contentEncoded);}
  3841. function replyWithContent(content,contentEncoded)
  3842. {this._content=content;this._contentEncoded=contentEncoded;var callbacks=this._pendingContentCallbacks.slice();for(var i=0;i<callbacks.length;++i)
  3843. callbacks[i](this._content);this._pendingContentCallbacks.length=0;delete this._contentRequested;}
  3844. function resourceContentLoaded(error,content,contentEncoded)
  3845. {contentLoaded.call(this,error,content,contentEncoded);}
  3846. if(this.request){this.request.requestContent(requestContentLoaded.bind(this));return;}
  3847. function requestContentLoaded(content)
  3848. {contentLoaded.call(this,null,content,this.request.contentEncoded);}
  3849. this.target().pageAgent().getResourceContent(this.frameId,this.url,resourceContentLoaded.bind(this));},isHidden:function()
  3850. {return!!this._isHidden;},hasTextContent:function()
  3851. {if(this._type.isTextType())
  3852. return true;if(this._type===WebInspector.resourceTypes.Other)
  3853. return!!this._content&&!this._contentEncoded;return false;},__proto__:WebInspector.SDKObject.prototype};WebInspector.ResourceTreeModel=function(target)
  3854. {WebInspector.SDKModel.call(this,WebInspector.ResourceTreeModel,target);target.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished,this._onRequestFinished,this);target.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestUpdateDropped,this._onRequestUpdateDropped,this);target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._consoleMessageAdded,this);target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);this._agent=target.pageAgent();this._agent.enable();this._fetchResourceTree();target.registerPageDispatcher(new WebInspector.PageDispatcher(this));this._pendingConsoleMessages={};this._securityOriginFrameCount={};this._inspectedPageURL="";}
  3855. WebInspector.ResourceTreeModel.EventTypes={FrameAdded:"FrameAdded",FrameNavigated:"FrameNavigated",FrameDetached:"FrameDetached",FrameResized:"FrameResized",MainFrameNavigated:"MainFrameNavigated",ResourceAdded:"ResourceAdded",WillLoadCachedResources:"WillLoadCachedResources",CachedResourcesLoaded:"CachedResourcesLoaded",DOMContentLoaded:"DOMContentLoaded",Load:"Load",WillReloadPage:"WillReloadPage",InspectedURLChanged:"InspectedURLChanged",SecurityOriginAdded:"SecurityOriginAdded",SecurityOriginRemoved:"SecurityOriginRemoved",ScreencastFrame:"ScreencastFrame",ScreencastVisibilityChanged:"ScreencastVisibilityChanged",ViewportChanged:"ViewportChanged",ColorPicked:"ColorPicked"}
  3856. WebInspector.ResourceTreeModel.prototype={_fetchResourceTree:function()
  3857. {this._frames={};delete this._cachedResourcesProcessed;this._agent.getResourceTree(this._processCachedResources.bind(this));},_processCachedResources:function(error,mainFramePayload)
  3858. {if(error){if(!this.target().isWorkerTarget())
  3859. console.error(JSON.stringify(error));return;}
  3860. this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources);this._inspectedPageURL=mainFramePayload.frame.url;this._addFramesRecursively(null,mainFramePayload);this._dispatchInspectedURLChanged();this._cachedResourcesProcessed=true;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded);},inspectedPageURL:function()
  3861. {return this._inspectedPageURL;},inspectedPageDomain:function()
  3862. {var parsedURL=this._inspectedPageURL?this._inspectedPageURL.asParsedURL():null;return parsedURL?parsedURL.host:"";},cachedResourcesLoaded:function()
  3863. {return this._cachedResourcesProcessed;},_dispatchInspectedURLChanged:function()
  3864. {InspectorFrontendHost.inspectedURLChanged(this._inspectedPageURL);this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._inspectedPageURL);},_addFrame:function(frame,aboutToNavigate)
  3865. {this._frames[frame.id]=frame;if(frame.isMainFrame())
  3866. this.mainFrame=frame;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameAdded,frame);if(!aboutToNavigate)
  3867. this._addSecurityOrigin(frame.securityOrigin);},_addSecurityOrigin:function(securityOrigin)
  3868. {if(!this._securityOriginFrameCount[securityOrigin]){this._securityOriginFrameCount[securityOrigin]=1;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,securityOrigin);return;}
  3869. this._securityOriginFrameCount[securityOrigin]+=1;},_removeSecurityOrigin:function(securityOrigin)
  3870. {if(typeof securityOrigin==="undefined")
  3871. return;if(this._securityOriginFrameCount[securityOrigin]===1){delete this._securityOriginFrameCount[securityOrigin];this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,securityOrigin);return;}
  3872. this._securityOriginFrameCount[securityOrigin]-=1;},securityOrigins:function()
  3873. {return Object.keys(this._securityOriginFrameCount);},_handleMainFrameDetached:function(mainFrame)
  3874. {function removeOriginForFrame(frame)
  3875. {for(var i=0;i<frame.childFrames.length;++i)
  3876. removeOriginForFrame.call(this,frame.childFrames[i]);if(!frame.isMainFrame())
  3877. this._removeSecurityOrigin(frame.securityOrigin);}
  3878. removeOriginForFrame.call(this,mainFrame);},_frameAttached:function(frameId,parentFrameId)
  3879. {if(!this._cachedResourcesProcessed)
  3880. return null;if(this._frames[frameId])
  3881. return null;var parentFrame=parentFrameId?this._frames[parentFrameId]:null;var frame=new WebInspector.ResourceTreeFrame(this,parentFrame,frameId);if(frame.isMainFrame()&&this.mainFrame){this._handleMainFrameDetached(this.mainFrame);this._frameDetached(this.mainFrame.id);}
  3882. this._addFrame(frame,true);return frame;},_frameNavigated:function(framePayload)
  3883. {if(!this._cachedResourcesProcessed)
  3884. return;var frame=this._frames[framePayload.id];if(!frame){console.assert(!framePayload.parentId,"Main frame shouldn't have parent frame id.");frame=this._frameAttached(framePayload.id,framePayload.parentId||"");console.assert(frame);}
  3885. this._removeSecurityOrigin(frame.securityOrigin);frame._navigate(framePayload);var addedOrigin=frame.securityOrigin;if(frame.isMainFrame())
  3886. this._inspectedPageURL=frame.url;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,frame);if(frame.isMainFrame())
  3887. this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,frame);if(addedOrigin)
  3888. this._addSecurityOrigin(addedOrigin);var resources=frame.resources();for(var i=0;i<resources.length;++i)
  3889. this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resources[i]);if(frame.isMainFrame())
  3890. this._dispatchInspectedURLChanged();},_frameDetached:function(frameId)
  3891. {if(!this._cachedResourcesProcessed)
  3892. return;var frame=this._frames[frameId];if(!frame)
  3893. return;this._removeSecurityOrigin(frame.securityOrigin);if(frame.parentFrame)
  3894. frame.parentFrame._removeChildFrame(frame);else
  3895. frame._remove();},_onRequestFinished:function(event)
  3896. {if(!this._cachedResourcesProcessed)
  3897. return;var request=(event.data);if(request.failed||request.resourceType()===WebInspector.resourceTypes.XHR)
  3898. return;var frame=this._frames[request.frameId];if(frame){var resource=frame._addRequest(request);this._addPendingConsoleMessagesToResource(resource);}},_onRequestUpdateDropped:function(event)
  3899. {if(!this._cachedResourcesProcessed)
  3900. return;var frameId=event.data.frameId;var frame=this._frames[frameId];if(!frame)
  3901. return;var url=event.data.url;if(frame._resourcesMap[url])
  3902. return;var resource=new WebInspector.Resource(this.target(),null,url,frame.url,frameId,event.data.loaderId,WebInspector.resourceTypes[event.data.resourceType],event.data.mimeType);frame.addResource(resource);},frameForId:function(frameId)
  3903. {return this._frames[frameId];},forAllResources:function(callback)
  3904. {if(this.mainFrame)
  3905. return this.mainFrame._callForFrameResources(callback);return false;},frames:function()
  3906. {return Object.values(this._frames);},_consoleMessageAdded:function(event)
  3907. {var msg=(event.data);var resource=msg.url?this.resourceForURL(msg.url):null;if(resource)
  3908. this._addConsoleMessageToResource(msg,resource);else
  3909. this._addPendingConsoleMessage(msg);},_addPendingConsoleMessage:function(msg)
  3910. {if(!msg.url)
  3911. return;if(!this._pendingConsoleMessages[msg.url])
  3912. this._pendingConsoleMessages[msg.url]=[];this._pendingConsoleMessages[msg.url].push(msg);},_addPendingConsoleMessagesToResource:function(resource)
  3913. {var messages=this._pendingConsoleMessages[resource.url];if(messages){for(var i=0;i<messages.length;i++)
  3914. this._addConsoleMessageToResource(messages[i],resource);delete this._pendingConsoleMessages[resource.url];}},_addConsoleMessageToResource:function(msg,resource)
  3915. {switch(msg.level){case WebInspector.ConsoleMessage.MessageLevel.Warning:resource.warnings++;break;case WebInspector.ConsoleMessage.MessageLevel.Error:resource.errors++;break;}
  3916. resource.addMessage(msg);},_consoleCleared:function()
  3917. {function callback(resource)
  3918. {resource.clearErrorsAndWarnings();}
  3919. this._pendingConsoleMessages={};this.forAllResources(callback);},resourceForURL:function(url)
  3920. {return this.mainFrame?this.mainFrame.resourceForURL(url):null;},_addFramesRecursively:function(parentFrame,frameTreePayload)
  3921. {var framePayload=frameTreePayload.frame;var frame=new WebInspector.ResourceTreeFrame(this,parentFrame,framePayload.id,framePayload);this._addFrame(frame);var frameResource=this._createResourceFromFramePayload(framePayload,framePayload.url,WebInspector.resourceTypes.Document,framePayload.mimeType);if(frame.isMainFrame())
  3922. this._inspectedPageURL=frameResource.url;if(!WebInspector.isWorkerFrontend())
  3923. frame.addResource(frameResource);for(var i=0;frameTreePayload.childFrames&&i<frameTreePayload.childFrames.length;++i)
  3924. this._addFramesRecursively(frame,frameTreePayload.childFrames[i]);for(var i=0;i<frameTreePayload.resources.length;++i){var subresource=frameTreePayload.resources[i];var resource=this._createResourceFromFramePayload(framePayload,subresource.url,WebInspector.resourceTypes[subresource.type],subresource.mimeType);frame.addResource(resource);}},_createResourceFromFramePayload:function(frame,url,type,mimeType)
  3925. {return new WebInspector.Resource(this.target(),null,url,frame.url,frame.id,frame.loaderId,type,mimeType);},reloadPage:function(ignoreCache,scriptToEvaluateOnLoad,scriptPreprocessor)
  3926. {this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillReloadPage);this._agent.reload(ignoreCache,scriptToEvaluateOnLoad,scriptPreprocessor);},__proto__:WebInspector.SDKModel.prototype}
  3927. WebInspector.ResourceTreeFrame=function(model,parentFrame,frameId,payload)
  3928. {this._model=model;this._parentFrame=parentFrame;this._id=frameId;this._url="";if(payload){this._loaderId=payload.loaderId;this._name=payload.name;this._url=payload.url;this._securityOrigin=payload.securityOrigin;this._mimeType=payload.mimeType;}
  3929. this._childFrames=[];this._resourcesMap={};if(this._parentFrame)
  3930. this._parentFrame._childFrames.push(this);}
  3931. WebInspector.ResourceTreeFrame.prototype={target:function()
  3932. {return this._model.target();},get id()
  3933. {return this._id;},get name()
  3934. {return this._name||"";},get url()
  3935. {return this._url;},get securityOrigin()
  3936. {return this._securityOrigin;},get loaderId()
  3937. {return this._loaderId;},get parentFrame()
  3938. {return this._parentFrame;},get childFrames()
  3939. {return this._childFrames;},isMainFrame:function()
  3940. {return!this._parentFrame;},_navigate:function(framePayload)
  3941. {this._loaderId=framePayload.loaderId;this._name=framePayload.name;this._url=framePayload.url;this._securityOrigin=framePayload.securityOrigin;this._mimeType=framePayload.mimeType;var mainResource=this._resourcesMap[this._url];this._resourcesMap={};this._removeChildFrames();if(mainResource&&mainResource.loaderId===this._loaderId)
  3942. this.addResource(mainResource);},get mainResource()
  3943. {return this._resourcesMap[this._url];},_removeChildFrame:function(frame)
  3944. {this._childFrames.remove(frame);frame._remove();},_removeChildFrames:function()
  3945. {var frames=this._childFrames;this._childFrames=[];for(var i=0;i<frames.length;++i)
  3946. frames[i]._remove();},_remove:function()
  3947. {this._removeChildFrames();delete this._model._frames[this.id];this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this);},addResource:function(resource)
  3948. {if(this._resourcesMap[resource.url]===resource){return;}
  3949. this._resourcesMap[resource.url]=resource;this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resource);},_addRequest:function(request)
  3950. {var resource=this._resourcesMap[request.url];if(resource&&resource.request===request){return resource;}
  3951. resource=new WebInspector.Resource(this.target(),request,request.url,request.documentURL,request.frameId,request.loaderId,request.resourceType(),request.mimeType);this._resourcesMap[resource.url]=resource;this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resource);return resource;},resources:function()
  3952. {var result=[];for(var url in this._resourcesMap)
  3953. result.push(this._resourcesMap[url]);return result;},resourceForURL:function(url)
  3954. {var result;function filter(resource)
  3955. {if(resource.url===url){result=resource;return true;}}
  3956. this._callForFrameResources(filter);return result||null;},_callForFrameResources:function(callback)
  3957. {for(var url in this._resourcesMap){if(callback(this._resourcesMap[url]))
  3958. return true;}
  3959. for(var i=0;i<this._childFrames.length;++i){if(this._childFrames[i]._callForFrameResources(callback))
  3960. return true;}
  3961. return false;},displayName:function()
  3962. {if(!this._parentFrame)
  3963. return WebInspector.UIString("<top frame>");var subtitle=new WebInspector.ParsedURL(this._url).displayName;if(subtitle){if(!this._name)
  3964. return subtitle;return this._name+"( "+subtitle+" )";}
  3965. return WebInspector.UIString("<iframe>");}}
  3966. WebInspector.PageDispatcher=function(resourceTreeModel)
  3967. {this._resourceTreeModel=resourceTreeModel;}
  3968. WebInspector.PageDispatcher.prototype={domContentEventFired:function(time)
  3969. {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded,time);},loadEventFired:function(time)
  3970. {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.Load,time);},frameAttached:function(frameId,parentFrameId)
  3971. {this._resourceTreeModel._frameAttached(frameId,parentFrameId);},frameNavigated:function(frame)
  3972. {this._resourceTreeModel._frameNavigated(frame);},frameDetached:function(frameId)
  3973. {this._resourceTreeModel._frameDetached(frameId);},frameStartedLoading:function(frameId)
  3974. {},frameStoppedLoading:function(frameId)
  3975. {},frameScheduledNavigation:function(frameId,delay)
  3976. {},frameClearedScheduledNavigation:function(frameId)
  3977. {},frameResized:function()
  3978. {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameResized,null);},javascriptDialogOpening:function(message)
  3979. {},javascriptDialogClosed:function()
  3980. {},scriptsEnabled:function(isEnabled)
  3981. {WebInspector.settings.javaScriptDisabled.set(!isEnabled);},screencastFrame:function(data,metadata,frameNumber)
  3982. {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame,{data:data,metadata:metadata,frameNumber:frameNumber});},screencastVisibilityChanged:function(visible)
  3983. {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ScreencastVisibilityChanged,{visible:visible});},viewportChanged:function(viewport)
  3984. {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ViewportChanged,viewport);},colorPicked:function(color)
  3985. {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ColorPicked,color);},interstitialShown:function()
  3986. {},interstitialHidden:function()
  3987. {}}
  3988. WebInspector.resourceTreeModel;;function SourceMapV3()
  3989. {this.version;this.file;this.sources;this.sections;this.mappings;this.sourceRoot;}
  3990. SourceMapV3.Section=function()
  3991. {this.map;this.offset;}
  3992. SourceMapV3.Offset=function()
  3993. {this.line;this.column;}
  3994. WebInspector.SourceMap=function(sourceMappingURL,payload)
  3995. {if(!WebInspector.SourceMap.prototype._base64Map){const base64Digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";WebInspector.SourceMap.prototype._base64Map={};for(var i=0;i<base64Digits.length;++i)
  3996. WebInspector.SourceMap.prototype._base64Map[base64Digits.charAt(i)]=i;}
  3997. this._sourceMappingURL=sourceMappingURL;this._reverseMappingsBySourceURL={};this._mappings=[];this._sources={};this._sourceContentByURL={};this._parseMappingPayload(payload);}
  3998. WebInspector.SourceMap.load=function(sourceMapURL,compiledURL,callback)
  3999. {var resourceTreeModel=WebInspector.resourceTreeModel;if(resourceTreeModel.cachedResourcesLoaded())
  4000. loadResource();else
  4001. resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded,cachedResourcesLoaded);function cachedResourcesLoaded()
  4002. {resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded,cachedResourcesLoaded);loadResource();}
  4003. function loadResource()
  4004. {var headers={};NetworkAgent.loadResourceForFrontend(resourceTreeModel.mainFrame.id,sourceMapURL,headers,contentLoaded);}
  4005. function contentLoaded(error,statusCode,headers,content)
  4006. {if(error||!content||statusCode>=400){callback(null);return;}
  4007. if(content.slice(0,3)===")]}")
  4008. content=content.substring(content.indexOf('\n'));try{var payload=(JSON.parse(content));var baseURL=sourceMapURL.startsWith("data:")?compiledURL:sourceMapURL;callback(new WebInspector.SourceMap(baseURL,payload));}catch(e){console.error(e.message);callback(null);}}}
  4009. WebInspector.SourceMap.prototype={url:function()
  4010. {return this._sourceMappingURL;},sources:function()
  4011. {return Object.keys(this._sources);},sourceContent:function(sourceURL)
  4012. {return this._sourceContentByURL[sourceURL];},sourceContentProvider:function(sourceURL,contentType)
  4013. {var sourceContent=this.sourceContent(sourceURL);if(sourceContent)
  4014. return new WebInspector.StaticContentProvider(contentType,sourceContent);return new WebInspector.CompilerSourceMappingContentProvider(sourceURL,contentType);},_parseMappingPayload:function(mappingPayload)
  4015. {if(mappingPayload.sections)
  4016. this._parseSections(mappingPayload.sections);else
  4017. this._parseMap(mappingPayload,0,0);},_parseSections:function(sections)
  4018. {for(var i=0;i<sections.length;++i){var section=sections[i];this._parseMap(section.map,section.offset.line,section.offset.column);}},findEntry:function(lineNumber,columnNumber)
  4019. {var first=0;var count=this._mappings.length;while(count>1){var step=count>>1;var middle=first+step;var mapping=this._mappings[middle];if(lineNumber<mapping[0]||(lineNumber===mapping[0]&&columnNumber<mapping[1]))
  4020. count=step;else{first=middle;count-=step;}}
  4021. var entry=this._mappings[first];if(!first&&entry&&(lineNumber<entry[0]||(lineNumber===entry[0]&&columnNumber<entry[1])))
  4022. return null;return entry;},findEntryReversed:function(sourceURL,lineNumber,span)
  4023. {var mappings=this._reverseMappingsBySourceURL[sourceURL];var maxLineNumber=typeof span==="number"?Math.min(lineNumber+span+1,mappings.length):mappings.length;for(;lineNumber<maxLineNumber;++lineNumber){var mapping=mappings[lineNumber];if(mapping)
  4024. return mapping;}
  4025. return null;},_parseMap:function(map,lineNumber,columnNumber)
  4026. {var sourceIndex=0;var sourceLineNumber=0;var sourceColumnNumber=0;var nameIndex=0;var sources=[];var originalToCanonicalURLMap={};for(var i=0;i<map.sources.length;++i){var originalSourceURL=map.sources[i];var sourceRoot=map.sourceRoot||"";if(sourceRoot&&!sourceRoot.endsWith("/"))
  4027. sourceRoot+="/";var href=sourceRoot+originalSourceURL;var url=WebInspector.ParsedURL.completeURL(this._sourceMappingURL,href)||href;originalToCanonicalURLMap[originalSourceURL]=url;sources.push(url);this._sources[url]=true;if(map.sourcesContent&&map.sourcesContent[i])
  4028. this._sourceContentByURL[url]=map.sourcesContent[i];}
  4029. var stringCharIterator=new WebInspector.SourceMap.StringCharIterator(map.mappings);var sourceURL=sources[sourceIndex];while(true){if(stringCharIterator.peek()===",")
  4030. stringCharIterator.next();else{while(stringCharIterator.peek()===";"){lineNumber+=1;columnNumber=0;stringCharIterator.next();}
  4031. if(!stringCharIterator.hasNext())
  4032. break;}
  4033. columnNumber+=this._decodeVLQ(stringCharIterator);if(!stringCharIterator.hasNext()||this._isSeparator(stringCharIterator.peek())){this._mappings.push([lineNumber,columnNumber]);continue;}
  4034. var sourceIndexDelta=this._decodeVLQ(stringCharIterator);if(sourceIndexDelta){sourceIndex+=sourceIndexDelta;sourceURL=sources[sourceIndex];}
  4035. sourceLineNumber+=this._decodeVLQ(stringCharIterator);sourceColumnNumber+=this._decodeVLQ(stringCharIterator);if(!this._isSeparator(stringCharIterator.peek()))
  4036. nameIndex+=this._decodeVLQ(stringCharIterator);this._mappings.push([lineNumber,columnNumber,sourceURL,sourceLineNumber,sourceColumnNumber]);}
  4037. for(var i=0;i<this._mappings.length;++i){var mapping=this._mappings[i];var url=mapping[2];if(!url)
  4038. continue;if(!this._reverseMappingsBySourceURL[url])
  4039. this._reverseMappingsBySourceURL[url]=[];var reverseMappings=this._reverseMappingsBySourceURL[url];var sourceLine=mapping[3];if(!reverseMappings[sourceLine])
  4040. reverseMappings[sourceLine]=[mapping[0],mapping[1]];}},_isSeparator:function(char)
  4041. {return char===","||char===";";},_decodeVLQ:function(stringCharIterator)
  4042. {var result=0;var shift=0;do{var digit=this._base64Map[stringCharIterator.next()];result+=(digit&this._VLQ_BASE_MASK)<<shift;shift+=this._VLQ_BASE_SHIFT;}while(digit&this._VLQ_CONTINUATION_MASK);var negative=result&1;result>>=1;return negative?-result:result;},_VLQ_BASE_SHIFT:5,_VLQ_BASE_MASK:(1<<5)-1,_VLQ_CONTINUATION_MASK:1<<5}
  4043. WebInspector.SourceMap.StringCharIterator=function(string)
  4044. {this._string=string;this._position=0;}
  4045. WebInspector.SourceMap.StringCharIterator.prototype={next:function()
  4046. {return this._string.charAt(this._position++);},peek:function()
  4047. {return this._string.charAt(this._position);},hasNext:function()
  4048. {return this._position<this._string.length;}};WebInspector.NetworkManager=function(target)
  4049. {WebInspector.SDKModel.call(this,WebInspector.NetworkManager,target);this._dispatcher=new WebInspector.NetworkDispatcher(this);this._target=target;this._networkAgent=target.networkAgent();target.registerNetworkDispatcher(this._dispatcher);if(WebInspector.settings.cacheDisabled.get())
  4050. this._networkAgent.setCacheDisabled(true);this._networkAgent.enable();WebInspector.settings.cacheDisabled.addChangeListener(this._cacheDisabledSettingChanged,this);}
  4051. WebInspector.NetworkManager.EventTypes={RequestStarted:"RequestStarted",RequestUpdated:"RequestUpdated",RequestFinished:"RequestFinished",RequestUpdateDropped:"RequestUpdateDropped"}
  4052. WebInspector.NetworkManager._MIMETypes={"text/html":{"document":true},"text/xml":{"document":true},"text/plain":{"document":true},"application/xhtml+xml":{"document":true},"text/css":{"stylesheet":true},"text/xsl":{"stylesheet":true},"image/jpg":{"image":true},"image/jpeg":{"image":true},"image/pjpeg":{"image":true},"image/png":{"image":true},"image/gif":{"image":true},"image/bmp":{"image":true},"image/svg+xml":{"image":true,"font":true,"document":true},"image/vnd.microsoft.icon":{"image":true},"image/webp":{"image":true},"image/x-icon":{"image":true},"image/x-xbitmap":{"image":true},"font/ttf":{"font":true},"font/otf":{"font":true},"font/woff":{"font":true},"font/woff2":{"font":true},"font/truetype":{"font":true},"font/opentype":{"font":true},"application/octet-stream":{"font":true,"image":true},"application/font-woff":{"font":true},"application/font-woff2":{"font":true},"application/x-font-woff":{"font":true},"application/x-font-type1":{"font":true},"application/x-font-ttf":{"font":true},"application/x-truetype-font":{"font":true},"text/javascript":{"script":true},"text/ecmascript":{"script":true},"application/javascript":{"script":true},"application/ecmascript":{"script":true},"application/x-javascript":{"script":true},"application/json":{"script":true},"text/javascript1.1":{"script":true},"text/javascript1.2":{"script":true},"text/javascript1.3":{"script":true},"text/jscript":{"script":true},"text/livescript":{"script":true},"text/vtt":{"texttrack":true},}
  4053. WebInspector.NetworkManager._devToolsRequestHeader="X-DevTools-Request-Initiator";WebInspector.NetworkManager.hasDevToolsRequestHeader=function(request)
  4054. {return!!request&&!!request.requestHeaderValue(WebInspector.NetworkManager._devToolsRequestHeader);}
  4055. WebInspector.NetworkManager.prototype={inflightRequestForURL:function(url)
  4056. {return this._dispatcher._inflightRequestsByURL[url];},_cacheDisabledSettingChanged:function(event)
  4057. {var enabled=(event.data);this._networkAgent.setCacheDisabled(enabled);},dispose:function()
  4058. {WebInspector.settings.cacheDisabled.removeChangeListener(this._cacheDisabledSettingChanged,this);},__proto__:WebInspector.SDKModel.prototype}
  4059. WebInspector.NetworkDispatcher=function(manager)
  4060. {this._manager=manager;this._inflightRequestsById={};this._inflightRequestsByURL={};}
  4061. WebInspector.NetworkDispatcher.prototype={_headersMapToHeadersArray:function(headersMap)
  4062. {var result=[];for(var name in headersMap){var values=headersMap[name].split("\n");for(var i=0;i<values.length;++i)
  4063. result.push({name:name,value:values[i]});}
  4064. return result;},_updateNetworkRequestWithRequest:function(networkRequest,request)
  4065. {networkRequest.requestMethod=request.method;networkRequest.setRequestHeaders(this._headersMapToHeadersArray(request.headers));networkRequest.requestFormData=request.postData;},_updateNetworkRequestWithResponse:function(networkRequest,response)
  4066. {if(response.url&&networkRequest.url!==response.url)
  4067. networkRequest.url=response.url;networkRequest.mimeType=response.mimeType;networkRequest.statusCode=response.status;networkRequest.statusText=response.statusText;networkRequest.responseHeaders=this._headersMapToHeadersArray(response.headers);if(response.encodedDataLength>=0)
  4068. networkRequest.setTransferSize(response.encodedDataLength);if(response.headersText)
  4069. networkRequest.responseHeadersText=response.headersText;if(response.requestHeaders){networkRequest.setRequestHeaders(this._headersMapToHeadersArray(response.requestHeaders));networkRequest.setRequestHeadersText(response.requestHeadersText||"");}
  4070. networkRequest.connectionReused=response.connectionReused;networkRequest.connectionId=String(response.connectionId);if(response.remoteIPAddress)
  4071. networkRequest.setRemoteAddress(response.remoteIPAddress,response.remotePort||-1);if(response.fromServiceWorker)
  4072. networkRequest.fetchedViaServiceWorker=true;if(response.fromDiskCache)
  4073. networkRequest.setFromDiskCache();networkRequest.timing=response.timing;networkRequest.protocol=response.protocol;if(!this._mimeTypeIsConsistentWithType(networkRequest)){var consoleModel=this._manager._target.consoleModel;consoleModel.addMessage(new WebInspector.ConsoleMessage(consoleModel.target(),WebInspector.ConsoleMessage.MessageSource.Network,WebInspector.ConsoleMessage.MessageLevel.Log,WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s: \"%s\".",networkRequest.resourceType().title(),networkRequest.mimeType,networkRequest.url),WebInspector.ConsoleMessage.MessageType.Log,"",0,0,networkRequest.requestId));}},_mimeTypeIsConsistentWithType:function(networkRequest)
  4074. {if(networkRequest.hasErrorStatusCode()||networkRequest.statusCode===304||networkRequest.statusCode===204)
  4075. return true;var resourceType=networkRequest.resourceType();if(resourceType===undefined||resourceType===WebInspector.resourceTypes.Other||resourceType===WebInspector.resourceTypes.Media||resourceType===WebInspector.resourceTypes.XHR||resourceType===WebInspector.resourceTypes.WebSocket)
  4076. return true;if(!networkRequest.mimeType)
  4077. return true;if(networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes)
  4078. return resourceType.name()in WebInspector.NetworkManager._MIMETypes[networkRequest.mimeType];return false;},requestWillBeSent:function(requestId,frameId,loaderId,documentURL,request,time,initiator,redirectResponse,resourceType)
  4079. {var networkRequest=this._inflightRequestsById[requestId];if(networkRequest){if(!redirectResponse)
  4080. return;this.responseReceived(requestId,frameId,loaderId,time,PageAgent.ResourceType.Other,redirectResponse);networkRequest=this._appendRedirect(requestId,time,request.url);}else
  4081. networkRequest=this._createNetworkRequest(requestId,frameId,loaderId,request.url,documentURL,initiator);networkRequest.hasNetworkData=true;this._updateNetworkRequestWithRequest(networkRequest,request);networkRequest.setIssueTime(time);networkRequest.setResourceType(WebInspector.resourceTypes[resourceType]);this._startNetworkRequest(networkRequest);},requestServedFromCache:function(requestId)
  4082. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4083. return;networkRequest.setFromMemoryCache();},responseReceived:function(requestId,frameId,loaderId,time,resourceType,response)
  4084. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest){var eventData={};eventData.url=response.url;eventData.frameId=frameId;eventData.loaderId=loaderId;eventData.resourceType=resourceType;eventData.mimeType=response.mimeType;this._manager.dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestUpdateDropped,eventData);return;}
  4085. networkRequest.responseReceivedTime=time;networkRequest.setResourceType(WebInspector.resourceTypes[resourceType]);this._updateNetworkRequestWithResponse(networkRequest,response);this._updateNetworkRequest(networkRequest);},dataReceived:function(requestId,time,dataLength,encodedDataLength)
  4086. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4087. return;networkRequest.resourceSize+=dataLength;if(encodedDataLength!=-1)
  4088. networkRequest.increaseTransferSize(encodedDataLength);networkRequest.endTime=time;this._updateNetworkRequest(networkRequest);},loadingFinished:function(requestId,finishTime,encodedDataLength)
  4089. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4090. return;this._finishNetworkRequest(networkRequest,finishTime,encodedDataLength);},loadingFailed:function(requestId,time,resourceType,localizedDescription,canceled)
  4091. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4092. return;networkRequest.failed=true;networkRequest.setResourceType(WebInspector.resourceTypes[resourceType]);networkRequest.canceled=canceled;networkRequest.localizedFailDescription=localizedDescription;this._finishNetworkRequest(networkRequest,time,-1);},webSocketCreated:function(requestId,requestURL)
  4093. {var networkRequest=new WebInspector.NetworkRequest(this._manager._target,requestId,requestURL,"","","",null);networkRequest.setResourceType(WebInspector.resourceTypes.WebSocket);this._startNetworkRequest(networkRequest);},webSocketWillSendHandshakeRequest:function(requestId,time,request)
  4094. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4095. return;networkRequest.requestMethod="GET";networkRequest.setRequestHeaders(this._headersMapToHeadersArray(request.headers));networkRequest.setIssueTime(time);this._updateNetworkRequest(networkRequest);},webSocketHandshakeResponseReceived:function(requestId,time,response)
  4096. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4097. return;networkRequest.statusCode=response.status;networkRequest.statusText=response.statusText;networkRequest.responseHeaders=this._headersMapToHeadersArray(response.headers);networkRequest.responseHeadersText=response.headersText;if(response.requestHeaders)
  4098. networkRequest.setRequestHeaders(this._headersMapToHeadersArray(response.requestHeaders));if(response.requestHeadersText)
  4099. networkRequest.setRequestHeadersText(response.requestHeadersText);networkRequest.responseReceivedTime=time;networkRequest.protocol="websocket";this._updateNetworkRequest(networkRequest);},webSocketFrameReceived:function(requestId,time,response)
  4100. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4101. return;networkRequest.addFrame(response,time);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketFrameSent:function(requestId,time,response)
  4102. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4103. return;networkRequest.addFrame(response,time,true);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketFrameError:function(requestId,time,errorMessage)
  4104. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4105. return;networkRequest.addFrameError(errorMessage,time);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketClosed:function(requestId,time)
  4106. {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
  4107. return;this._finishNetworkRequest(networkRequest,time,-1);},_appendRedirect:function(requestId,time,redirectURL)
  4108. {var originalNetworkRequest=this._inflightRequestsById[requestId];var previousRedirects=originalNetworkRequest.redirects||[];originalNetworkRequest.requestId=requestId+":redirected."+previousRedirects.length;delete originalNetworkRequest.redirects;if(previousRedirects.length>0)
  4109. originalNetworkRequest.redirectSource=previousRedirects[previousRedirects.length-1];this._finishNetworkRequest(originalNetworkRequest,time,-1);var newNetworkRequest=this._createNetworkRequest(requestId,originalNetworkRequest.frameId,originalNetworkRequest.loaderId,redirectURL,originalNetworkRequest.documentURL,originalNetworkRequest.initiator());newNetworkRequest.redirects=previousRedirects.concat(originalNetworkRequest);return newNetworkRequest;},_startNetworkRequest:function(networkRequest)
  4110. {this._inflightRequestsById[networkRequest.requestId]=networkRequest;this._inflightRequestsByURL[networkRequest.url]=networkRequest;this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestStarted,networkRequest);},_updateNetworkRequest:function(networkRequest)
  4111. {this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestUpdated,networkRequest);},_finishNetworkRequest:function(networkRequest,finishTime,encodedDataLength)
  4112. {networkRequest.endTime=finishTime;networkRequest.finished=true;if(encodedDataLength>=0)
  4113. networkRequest.setTransferSize(encodedDataLength);this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestFinished,networkRequest);delete this._inflightRequestsById[networkRequest.requestId];delete this._inflightRequestsByURL[networkRequest.url];},_dispatchEventToListeners:function(eventType,networkRequest)
  4114. {this._manager.dispatchEventToListeners(eventType,networkRequest);},_createNetworkRequest:function(requestId,frameId,loaderId,url,documentURL,initiator)
  4115. {return new WebInspector.NetworkRequest(this._manager._target,requestId,url,documentURL,frameId,loaderId,initiator);}};WebInspector.NetworkRequest=function(target,requestId,url,documentURL,frameId,loaderId,initiator)
  4116. {WebInspector.SDKObject.call(this,target);this._requestId=requestId;this.url=url;this._documentURL=documentURL;this._frameId=frameId;this._loaderId=loaderId;this._initiator=initiator;this._issueTime=-1;this._startTime=-1;this._endTime=-1;this.statusCode=0;this.statusText="";this.requestMethod="";this.requestTime=0;this.protocol="";this._resourceType=WebInspector.resourceTypes.Other;this._contentEncoded=false;this._pendingContentCallbacks=[];this._frames=[];this._responseHeaderValues={};this._remoteAddress="";this.connectionId="0";}
  4117. WebInspector.NetworkRequest.Events={FinishedLoading:"FinishedLoading",TimingChanged:"TimingChanged",RemoteAddressChanged:"RemoteAddressChanged",RequestHeadersChanged:"RequestHeadersChanged",ResponseHeadersChanged:"ResponseHeadersChanged",WebsocketFrameAdded:"WebsocketFrameAdded",}
  4118. WebInspector.NetworkRequest.InitiatorType={Other:"other",Parser:"parser",Redirect:"redirect",Script:"script"}
  4119. WebInspector.NetworkRequest.NameValue;WebInspector.NetworkRequest.WebSocketFrameType={Send:"send",Receive:"receive",Error:"error"}
  4120. WebInspector.NetworkRequest.WebSocketFrame;WebInspector.NetworkRequest.prototype={indentityCompare:function(other){if(this._requestId>other._requestId)
  4121. return 1;if(this._requestId<other._requestId)
  4122. return-1;return 0;},get requestId()
  4123. {return this._requestId;},set requestId(requestId)
  4124. {this._requestId=requestId;},get url()
  4125. {return this._url;},set url(x)
  4126. {if(this._url===x)
  4127. return;this._url=x;this._parsedURL=new WebInspector.ParsedURL(x);delete this._queryString;delete this._parsedQueryParameters;delete this._name;delete this._path;},get documentURL()
  4128. {return this._documentURL;},get parsedURL()
  4129. {return this._parsedURL;},get frameId()
  4130. {return this._frameId;},get loaderId()
  4131. {return this._loaderId;},setRemoteAddress:function(ip,port)
  4132. {if(ip.indexOf(":")!==-1)
  4133. ip="["+ip+"]";this._remoteAddress=ip+":"+port;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RemoteAddressChanged,this);},remoteAddress:function()
  4134. {return this._remoteAddress;},get startTime()
  4135. {return this._startTime||-1;},setIssueTime:function(x)
  4136. {this._issueTime=x;this._startTime=x;},issueTime:function()
  4137. {return this._issueTime;},get responseReceivedTime()
  4138. {return this._responseReceivedTime||-1;},set responseReceivedTime(x)
  4139. {this._responseReceivedTime=x;},get endTime()
  4140. {return this._endTime||-1;},set endTime(x)
  4141. {if(this.timing&&this.timing.requestTime){this._endTime=Math.max(x,this.responseReceivedTime);}else{this._endTime=x;if(this._responseReceivedTime>x)
  4142. this._responseReceivedTime=x;}
  4143. this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.TimingChanged,this);},get duration()
  4144. {if(this._endTime===-1||this._startTime===-1)
  4145. return-1;return this._endTime-this._startTime;},get latency()
  4146. {if(this._responseReceivedTime===-1||this._startTime===-1)
  4147. return-1;return this._responseReceivedTime-this._startTime;},get resourceSize()
  4148. {return this._resourceSize||0;},set resourceSize(x)
  4149. {this._resourceSize=x;},get transferSize()
  4150. {return this._transferSize||0;},increaseTransferSize:function(x)
  4151. {this._transferSize=(this._transferSize||0)+x;},setTransferSize:function(x)
  4152. {this._transferSize=x;},get finished()
  4153. {return this._finished;},set finished(x)
  4154. {if(this._finished===x)
  4155. return;this._finished=x;if(x){this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.FinishedLoading,this);if(this._pendingContentCallbacks.length)
  4156. this._innerRequestContent();}},get failed()
  4157. {return this._failed;},set failed(x)
  4158. {this._failed=x;},get canceled()
  4159. {return this._canceled;},set canceled(x)
  4160. {this._canceled=x;},cached:function()
  4161. {return(!!this._fromMemoryCache||!!this._fromDiskCache)&&!this._transferSize;},setFromMemoryCache:function()
  4162. {this._fromMemoryCache=true;delete this._timing;},setFromDiskCache:function()
  4163. {this._fromDiskCache=true;},get fetchedViaServiceWorker()
  4164. {return this._fetchedViaServiceWorker;},set fetchedViaServiceWorker(x)
  4165. {this._fetchedViaServiceWorker=x;},get timing()
  4166. {return this._timing;},set timing(x)
  4167. {if(x&&!this._fromMemoryCache){this._startTime=x.requestTime;this._responseReceivedTime=x.requestTime+x.receiveHeadersEnd/1000.0;this._timing=x;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.TimingChanged,this);}},get mimeType()
  4168. {return this._mimeType;},set mimeType(x)
  4169. {this._mimeType=x;},get displayName()
  4170. {return this._parsedURL.displayName;},name:function()
  4171. {if(this._name)
  4172. return this._name;this._parseNameAndPathFromURL();return this._name;},path:function()
  4173. {if(this._path)
  4174. return this._path;this._parseNameAndPathFromURL();return this._path;},_parseNameAndPathFromURL:function()
  4175. {if(this._parsedURL.isDataURL()){this._name=this._parsedURL.dataURLDisplayName();this._path="";}else if(this._parsedURL.isAboutBlank()){this._name=this._parsedURL.url;this._path="";}else{this._path=this._parsedURL.host+this._parsedURL.folderPathComponents;this._path=this._path.trimURL(this.target().resourceTreeModel.inspectedPageDomain());if(this._parsedURL.lastPathComponent||this._parsedURL.queryParams)
  4176. this._name=this._parsedURL.lastPathComponent+(this._parsedURL.queryParams?"?"+this._parsedURL.queryParams:"");else if(this._parsedURL.folderPathComponents){this._name=this._parsedURL.folderPathComponents.substring(this._parsedURL.folderPathComponents.lastIndexOf("/")+1)+"/";this._path=this._path.substring(0,this._path.lastIndexOf("/"));}else{this._name=this._parsedURL.host;this._path="";}}},get folder()
  4177. {var path=this._parsedURL.path;var indexOfQuery=path.indexOf("?");if(indexOfQuery!==-1)
  4178. path=path.substring(0,indexOfQuery);var lastSlashIndex=path.lastIndexOf("/");return lastSlashIndex!==-1?path.substring(0,lastSlashIndex):"";},resourceType:function()
  4179. {return this._resourceType;},setResourceType:function(resourceType)
  4180. {this._resourceType=resourceType;},get domain()
  4181. {return this._parsedURL.host;},get scheme()
  4182. {return this._parsedURL.scheme;},get redirectSource()
  4183. {if(this.redirects&&this.redirects.length>0)
  4184. return this.redirects[this.redirects.length-1];return this._redirectSource;},set redirectSource(x)
  4185. {this._redirectSource=x;delete this._initiatorInfo;},requestHeaders:function()
  4186. {return this._requestHeaders||[];},setRequestHeaders:function(headers)
  4187. {this._requestHeaders=headers;delete this._requestCookies;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RequestHeadersChanged);},requestHeadersText:function()
  4188. {return this._requestHeadersText;},setRequestHeadersText:function(text)
  4189. {this._requestHeadersText=text;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RequestHeadersChanged);},requestHeaderValue:function(headerName)
  4190. {return this._headerValue(this.requestHeaders(),headerName);},get requestCookies()
  4191. {if(!this._requestCookies)
  4192. this._requestCookies=WebInspector.CookieParser.parseCookie(this.requestHeaderValue("Cookie"));return this._requestCookies;},get requestFormData()
  4193. {return this._requestFormData;},set requestFormData(x)
  4194. {this._requestFormData=x;delete this._parsedFormParameters;},requestHttpVersion:function()
  4195. {var headersText=this.requestHeadersText();if(!headersText)
  4196. return this.requestHeaderValue("version")||this.requestHeaderValue(":version")||"unknown";var firstLine=headersText.split(/\r\n/)[0];var match=firstLine.match(/(HTTP\/\d+\.\d+)$/);return match?match[1]:"HTTP/0.9";},get responseHeaders()
  4197. {return this._responseHeaders||[];},set responseHeaders(x)
  4198. {this._responseHeaders=x;delete this._sortedResponseHeaders;delete this._responseCookies;this._responseHeaderValues={};this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.ResponseHeadersChanged);},get responseHeadersText()
  4199. {return this._responseHeadersText;},set responseHeadersText(x)
  4200. {this._responseHeadersText=x;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.ResponseHeadersChanged);},get sortedResponseHeaders()
  4201. {if(this._sortedResponseHeaders!==undefined)
  4202. return this._sortedResponseHeaders;this._sortedResponseHeaders=this.responseHeaders.slice();this._sortedResponseHeaders.sort(function(a,b){return a.name.toLowerCase().compareTo(b.name.toLowerCase());});return this._sortedResponseHeaders;},responseHeaderValue:function(headerName)
  4203. {var value=this._responseHeaderValues[headerName];if(value===undefined){value=this._headerValue(this.responseHeaders,headerName);this._responseHeaderValues[headerName]=(value!==undefined)?value:null;}
  4204. return(value!==null)?value:undefined;},get responseCookies()
  4205. {if(!this._responseCookies)
  4206. this._responseCookies=WebInspector.CookieParser.parseSetCookie(this.responseHeaderValue("Set-Cookie"));return this._responseCookies;},queryString:function()
  4207. {if(this._queryString!==undefined)
  4208. return this._queryString;var queryString=null;var url=this.url;var questionMarkPosition=url.indexOf("?");if(questionMarkPosition!==-1){queryString=url.substring(questionMarkPosition+1);var hashSignPosition=queryString.indexOf("#");if(hashSignPosition!==-1)
  4209. queryString=queryString.substring(0,hashSignPosition);}
  4210. this._queryString=queryString;return this._queryString;},get queryParameters()
  4211. {if(this._parsedQueryParameters)
  4212. return this._parsedQueryParameters;var queryString=this.queryString();if(!queryString)
  4213. return null;this._parsedQueryParameters=this._parseParameters(queryString);return this._parsedQueryParameters;},get formParameters()
  4214. {if(this._parsedFormParameters)
  4215. return this._parsedFormParameters;if(!this.requestFormData)
  4216. return null;var requestContentType=this.requestContentType();if(!requestContentType||!requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i))
  4217. return null;this._parsedFormParameters=this._parseParameters(this.requestFormData);return this._parsedFormParameters;},responseHttpVersion:function()
  4218. {var headersText=this._responseHeadersText;if(!headersText)
  4219. return this.responseHeaderValue("version")||this.responseHeaderValue(":version")||"unknown";var firstLine=headersText.split(/\r\n/)[0];var match=firstLine.match(/^(HTTP\/\d+\.\d+)/);return match?match[1]:"HTTP/0.9";},_parseParameters:function(queryString)
  4220. {function parseNameValue(pair)
  4221. {var position=pair.indexOf("=");if(position===-1)
  4222. return{name:pair,value:""};else
  4223. return{name:pair.substring(0,position),value:pair.substring(position+1)};}
  4224. return queryString.split("&").map(parseNameValue);},_headerValue:function(headers,headerName)
  4225. {headerName=headerName.toLowerCase();var values=[];for(var i=0;i<headers.length;++i){if(headers[i].name.toLowerCase()===headerName)
  4226. values.push(headers[i].value);}
  4227. if(!values.length)
  4228. return undefined;if(headerName==="set-cookie")
  4229. return values.join("\n");return values.join(", ");},get content()
  4230. {return this._content;},contentError:function()
  4231. {return this._contentError;},get contentEncoded()
  4232. {return this._contentEncoded;},contentURL:function()
  4233. {return this._url;},contentType:function()
  4234. {return this._resourceType;},requestContent:function(callback)
  4235. {if(this._resourceType===WebInspector.resourceTypes.WebSocket){callback(null);return;}
  4236. if(typeof this._content!=="undefined"){callback(this.content||null);return;}
  4237. this._pendingContentCallbacks.push(callback);if(this.finished)
  4238. this._innerRequestContent();},searchInContent:function(query,caseSensitive,isRegex,callback)
  4239. {callback([]);},isHttpFamily:function()
  4240. {return!!this.url.match(/^https?:/i);},requestContentType:function()
  4241. {return this.requestHeaderValue("Content-Type");},hasErrorStatusCode:function()
  4242. {return this.statusCode>=400;},populateImageSource:function(image)
  4243. {WebInspector.Resource.populateImageSource(this._url,this._mimeType,this,image);},asDataURL:function()
  4244. {var content=this._content;if(!this._contentEncoded)
  4245. content=window.btoa(content);return WebInspector.Resource.contentAsDataURL(content,this.mimeType,true);},_innerRequestContent:function()
  4246. {if(this._contentRequested)
  4247. return;this._contentRequested=true;function onResourceContent(error,content,contentEncoded)
  4248. {this._content=error?null:content;this._contentError=error;this._contentEncoded=contentEncoded;var callbacks=this._pendingContentCallbacks.slice();for(var i=0;i<callbacks.length;++i)
  4249. callbacks[i](this._content);this._pendingContentCallbacks.length=0;delete this._contentRequested;}
  4250. NetworkAgent.getResponseBody(this._requestId,onResourceContent.bind(this));},initiator:function()
  4251. {return this._initiator;},initiatorInfo:function()
  4252. {if(this._initiatorInfo)
  4253. return this._initiatorInfo;var type=WebInspector.NetworkRequest.InitiatorType.Other;var url="";var lineNumber=-Infinity;var columnNumber=-Infinity;var initiator=this._initiator;if(this.redirectSource){type=WebInspector.NetworkRequest.InitiatorType.Redirect;url=this.redirectSource.url;}else if(initiator){if(initiator.type===NetworkAgent.InitiatorType.Parser){type=WebInspector.NetworkRequest.InitiatorType.Parser;url=initiator.url?initiator.url:url;lineNumber=initiator.lineNumber?initiator.lineNumber:lineNumber;}else if(initiator.type===NetworkAgent.InitiatorType.Script){var topFrame=initiator.stackTrace[0];if(topFrame.url){type=WebInspector.NetworkRequest.InitiatorType.Script;url=topFrame.url;lineNumber=topFrame.lineNumber;columnNumber=topFrame.columnNumber;}}}
  4254. this._initiatorInfo={type:type,url:url,lineNumber:lineNumber,columnNumber:columnNumber};return this._initiatorInfo;},frames:function()
  4255. {return this._frames;},addFrameError:function(errorMessage,time)
  4256. {this._addFrame({type:WebInspector.NetworkRequest.WebSocketFrameType.Error,text:errorMessage,time:time,opCode:-1,mask:false});},addFrame:function(response,time,sent)
  4257. {var type=sent?WebInspector.NetworkRequest.WebSocketFrameType.Send:WebInspector.NetworkRequest.WebSocketFrameType.Receive;this._addFrame({type:type,text:response.payloadData,time:time,opCode:response.opcode,mask:response.mask});},_addFrame:function(frame)
  4258. {this._frames.push(frame);this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.WebsocketFrameAdded,frame);},replayXHR:function()
  4259. {this.target().networkAgent().replayXHR(this.requestId);},__proto__:WebInspector.SDKObject.prototype};WebInspector.PictureFragment;WebInspector.PaintProfilerSnapshot=function(target,snapshotId)
  4260. {this._target=target;this._id=snapshotId;}
  4261. WebInspector.PaintProfilerSnapshot.loadFromFragments=function(target,fragments,callback)
  4262. {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.loadSnapshot(): ",WebInspector.PaintProfilerSnapshot.bind(null,target));target.layerTreeAgent().loadSnapshot(fragments,wrappedCallback);}
  4263. WebInspector.PaintProfilerSnapshot.load=function(target,encodedPicture,callback)
  4264. {var fragment={x:0,y:0,picture:encodedPicture};WebInspector.PaintProfilerSnapshot.loadFromFragments(target,[fragment],callback);}
  4265. WebInspector.PaintProfilerSnapshot._processAnnotations=function(log)
  4266. {var result=[];var commentGroupStack=[];for(var i=0;i<log.length;++i){var method=log[i].method;switch(method){case"beginCommentGroup":commentGroupStack.push({});break;case"addComment":var group=commentGroupStack.peekLast();if(!group){console.assert(false,"Stray comment without a group");break;}
  4267. var key=String(log[i].params["key"]);var value=String(log[i].params["value"]);if(!key||typeof value==="undefined"){console.assert(false,"Missing key or value in addComment() params");break;}
  4268. if(key in group){console.assert(false,"Duplicate key in comment group");break;}
  4269. group[key]=value;break;case"endCommentGroup":if(!commentGroupStack.length)
  4270. console.assert(false,"Unbalanced commentGroupEnd call");else
  4271. commentGroupStack.pop();break;default:result.push(new WebInspector.PaintProfilerLogItem(log[i],i,commentGroupStack.peekLast()));}}
  4272. return result;}
  4273. WebInspector.PaintProfilerSnapshot.prototype={dispose:function()
  4274. {this._target.layerTreeAgent().releaseSnapshot(this._id);},target:function()
  4275. {return this._target;},requestImage:function(firstStep,lastStep,scale,callback)
  4276. {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.replaySnapshot(): ");this._target.layerTreeAgent().replaySnapshot(this._id,firstStep||undefined,lastStep||undefined,scale||1.0,wrappedCallback);},profile:function(clipRect,callback)
  4277. {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.profileSnapshot(): ");this._target.layerTreeAgent().profileSnapshot(this._id,5,1,clipRect||undefined,wrappedCallback);},commandLog:function(callback)
  4278. {function callbackWrapper(error,log)
  4279. {if(error){console.error("LayerTreeAgent.snapshotCommandLog(): "+error);callback();return;}
  4280. callback(WebInspector.PaintProfilerSnapshot._processAnnotations(log));}
  4281. this._target.layerTreeAgent().snapshotCommandLog(this._id,callbackWrapper);}};WebInspector.RawPaintProfilerLogItem;WebInspector.PaintProfilerLogItem=function(rawEntry,commandIndex,annotations)
  4282. {this.method=rawEntry.method;this.params=rawEntry.params;this.annotations=annotations;this.commandIndex=commandIndex;}
  4283. WebInspector.PaintProfilerLogItem.prototype={nodeId:function()
  4284. {if(!this.annotations)
  4285. return 0;var inspectorId=this.annotations["INSPECTOR_ID"];return Number(inspectorId);}};WebInspector.HeapProfilerModel=function(target)
  4286. {WebInspector.SDKModel.call(this,WebInspector.HeapProfilerModel,target);target.registerHeapProfilerDispatcher(new WebInspector.HeapProfilerDispatcher(this));this._enabled=false;this._heapProfilerAgent=target.heapProfilerAgent();}
  4287. WebInspector.HeapProfilerModel.Events={HeapStatsUpdate:"HeapStatsUpdate",LastSeenObjectId:"LastSeenObjectId",AddHeapSnapshotChunk:"AddHeapSnapshotChunk",ReportHeapSnapshotProgress:"ReportHeapSnapshotProgress",ResetProfiles:"ResetProfiles"}
  4288. WebInspector.HeapProfilerModel.prototype={enable:function()
  4289. {if(this._enabled)
  4290. return;this._enabled=true;this._heapProfilerAgent.enable();},heapStatsUpdate:function(samples)
  4291. {this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.HeapStatsUpdate,samples);},lastSeenObjectId:function(lastSeenObjectId,timestamp)
  4292. {this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.LastSeenObjectId,{lastSeenObjectId:lastSeenObjectId,timestamp:timestamp});},addHeapSnapshotChunk:function(chunk)
  4293. {this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.AddHeapSnapshotChunk,chunk);},reportHeapSnapshotProgress:function(done,total,finished)
  4294. {this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ReportHeapSnapshotProgress,{done:done,total:total,finished:finished});},resetProfiles:function()
  4295. {this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ResetProfiles);},__proto__:WebInspector.SDKModel.prototype}
  4296. WebInspector.HeapProfilerDispatcher=function(model)
  4297. {this._heapProfilerModel=model;}
  4298. WebInspector.HeapProfilerDispatcher.prototype={heapStatsUpdate:function(samples)
  4299. {this._heapProfilerModel.heapStatsUpdate(samples);},lastSeenObjectId:function(lastSeenObjectId,timestamp)
  4300. {this._heapProfilerModel.lastSeenObjectId(lastSeenObjectId,timestamp);},addHeapSnapshotChunk:function(chunk)
  4301. {this._heapProfilerModel.addHeapSnapshotChunk(chunk);},reportHeapSnapshotProgress:function(done,total,finished)
  4302. {this._heapProfilerModel.reportHeapSnapshotProgress(done,total,finished);},resetProfiles:function()
  4303. {this._heapProfilerModel.resetProfiles();}};WebInspector.CSSMetadata.initializeWithSupportedProperties([{"name":"color"},{"name":"direction"},{"name":"font-family"},{"name":"font-kerning"},{"name":"font-size"},{"name":"font-stretch"},{"name":"font-style"},{"name":"font-variant"},{"name":"font-variant-ligatures"},{"name":"font-weight"},{"name":"-webkit-font-feature-settings"},{"name":"-webkit-font-smoothing"},{"name":"-webkit-locale"},{"name":"-webkit-text-orientation"},{"name":"-webkit-writing-mode"},{"name":"text-rendering"},{"name":"zoom"},{"name":"align-content"},{"name":"align-items"},{"name":"alignment-baseline"},{"name":"align-self"},{"name":"backface-visibility"},{"name":"background-attachment"},{"name":"background-blend-mode"},{"name":"background-clip"},{"name":"background-color"},{"name":"background-image"},{"name":"background-origin"},{"name":"background-position-x"},{"name":"background-position-y"},{"name":"background-repeat-x"},{"name":"background-repeat-y"},{"name":"background-size"},{"name":"baseline-shift"},{"name":"border-bottom-color"},{"name":"border-bottom-left-radius"},{"name":"border-bottom-right-radius"},{"name":"border-bottom-style"},{"name":"border-bottom-width"},{"name":"border-collapse"},{"name":"border-image-outset"},{"name":"border-image-repeat"},{"name":"border-image-slice"},{"name":"border-image-source"},{"name":"border-image-width"},{"name":"border-left-color"},{"name":"border-left-style"},{"name":"border-left-width"},{"name":"border-right-color"},{"name":"border-right-style"},{"name":"border-right-width"},{"name":"border-top-color"},{"name":"border-top-left-radius"},{"name":"border-top-right-radius"},{"name":"border-top-style"},{"name":"border-top-width"},{"name":"bottom"},{"name":"box-shadow"},{"name":"box-sizing"},{"name":"buffered-rendering"},{"name":"caption-side"},{"name":"clear"},{"name":"clip"},{"name":"clip-path"},{"name":"clip-rule"},{"name":"color-interpolation"},{"name":"color-interpolation-filters"},{"name":"color-rendering"},{"name":"content"},{"name":"counter-increment"},{"name":"counter-reset"},{"name":"cursor"},{"name":"display"},{"name":"dominant-baseline"},{"name":"empty-cells"},{"name":"fill"},{"name":"fill-opacity"},{"name":"fill-rule"},{"name":"filter"},{"name":"flex-basis"},{"name":"flex-direction"},{"name":"flex-grow"},{"name":"flex-shrink"},{"name":"flex-wrap"},{"name":"float"},{"name":"flood-color"},{"name":"flood-opacity"},{"name":"glyph-orientation-horizontal"},{"name":"glyph-orientation-vertical"},{"name":"height"},{"name":"image-rendering"},{"name":"justify-content"},{"name":"left"},{"name":"letter-spacing"},{"name":"lighting-color"},{"name":"line-height"},{"name":"list-style-image"},{"name":"list-style-position"},{"name":"list-style-type"},{"name":"margin-bottom"},{"name":"margin-left"},{"name":"margin-right"},{"name":"margin-top"},{"name":"marker-end"},{"name":"marker-mid"},{"name":"marker-start"},{"name":"mask"},{"name":"mask-type"},{"name":"max-height"},{"name":"max-width"},{"name":"min-height"},{"name":"min-width"},{"name":"object-fit"},{"name":"object-position"},{"name":"opacity"},{"name":"order"},{"name":"orphans"},{"name":"outline-color"},{"name":"outline-offset"},{"name":"outline-style"},{"name":"outline-width"},{"name":"overflow-wrap"},{"name":"overflow-x"},{"name":"overflow-y"},{"name":"padding-bottom"},{"name":"padding-left"},{"name":"padding-right"},{"name":"padding-top"},{"name":"page-break-after"},{"name":"page-break-before"},{"name":"page-break-inside"},{"name":"paint-order"},{"name":"perspective"},{"name":"perspective-origin"},{"name":"pointer-events"},{"name":"position"},{"name":"quotes"},{"name":"resize"},{"name":"right"},{"name":"shape-image-threshold"},{"name":"shape-margin"},{"name":"shape-outside"},{"name":"shape-rendering"},{"name":"size"},{"name":"speak"},{"name":"stop-color"},{"name":"stop-opacity"},{"name":"stroke"},{"name":"stroke-dasharray"},{"name":"stroke-dashoffset"},{"name":"stroke-linecap"},{"name":"stroke-linejoin"},{"name":"stroke-miterlimit"},{"name":"stroke-opacity"},{"name":"stroke-width"},{"name":"table-layout"},{"name":"tab-size"},{"name":"text-align"},{"name":"text-anchor"},{"name":"text-decoration"},{"name":"text-indent"},{"name":"text-overflow"},{"name":"text-shadow"},{"name":"text-transform"},{"name":"top"},{"name":"touch-action"},{"name":"transform"},{"name":"transform-origin"},{"name":"transform-style"},{"name":"unicode-bidi"},{"name":"vector-effect"},{"name":"vertical-align"},{"name":"visibility"},{"name":"-webkit-animation-delay"},{"name":"-webkit-animation-direction"},{"name":"-webkit-animation-duration"},{"name":"-webkit-animation-fill-mode"},{"name":"-webkit-animation-iteration-count"},{"name":"-webkit-animation-name"},{"name":"-webkit-animation-play-state"},{"name":"-webkit-animation-timing-function"},{"name":"-webkit-appearance"},{"name":"-webkit-app-region"},{"name":"-webkit-backface-visibility"},{"name":"-webkit-background-clip"},{"name":"-webkit-background-composite"},{"name":"-webkit-background-origin"},{"name":"-webkit-background-size"},{"name":"-webkit-border-horizontal-spacing"},{"name":"-webkit-border-image"},{"name":"-webkit-border-vertical-spacing"},{"name":"-webkit-box-align"},{"name":"-webkit-box-decoration-break"},{"name":"-webkit-box-direction"},{"name":"-webkit-box-flex"},{"name":"-webkit-box-flex-group"},{"name":"-webkit-box-lines"},{"name":"-webkit-box-ordinal-group"},{"name":"-webkit-box-orient"},{"name":"-webkit-box-pack"},{"name":"-webkit-box-reflect"},{"name":"-webkit-box-shadow"},{"name":"-webkit-clip-path"},{"name":"-webkit-column-break-after"},{"name":"-webkit-column-break-before"},{"name":"-webkit-column-break-inside"},{"name":"-webkit-column-count"},{"name":"-webkit-column-gap"},{"name":"-webkit-column-rule-color"},{"name":"-webkit-column-rule-style"},{"name":"-webkit-column-rule-width"},{"name":"-webkit-column-span"},{"name":"-webkit-column-width"},{"name":"-webkit-filter"},{"name":"-webkit-highlight"},{"name":"-webkit-hyphenate-character"},{"name":"-webkit-line-box-contain"},{"name":"-webkit-line-break"},{"name":"-webkit-line-clamp"},{"name":"-webkit-margin-after-collapse"},{"name":"-webkit-margin-before-collapse"},{"name":"-webkit-margin-bottom-collapse"},{"name":"-webkit-margin-top-collapse"},{"name":"-webkit-mask-box-image-outset"},{"name":"-webkit-mask-box-image-repeat"},{"name":"-webkit-mask-box-image-slice"},{"name":"-webkit-mask-box-image-source"},{"name":"-webkit-mask-box-image-width"},{"name":"-webkit-mask-clip"},{"name":"-webkit-mask-composite"},{"name":"-webkit-mask-image"},{"name":"-webkit-mask-origin"},{"name":"-webkit-mask-position-x"},{"name":"-webkit-mask-position-y"},{"name":"-webkit-mask-repeat-x"},{"name":"-webkit-mask-repeat-y"},{"name":"-webkit-mask-size"},{"name":"-webkit-perspective"},{"name":"-webkit-perspective-origin"},{"name":"-webkit-perspective-origin-x"},{"name":"-webkit-perspective-origin-y"},{"name":"-webkit-print-color-adjust"},{"name":"-webkit-rtl-ordering"},{"name":"-webkit-ruby-position"},{"name":"-webkit-tap-highlight-color"},{"name":"-webkit-text-combine"},{"name":"-webkit-text-emphasis-color"},{"name":"-webkit-text-emphasis-position"},{"name":"-webkit-text-emphasis-style"},{"name":"-webkit-text-fill-color"},{"name":"-webkit-text-security"},{"name":"-webkit-text-stroke-color"},{"name":"-webkit-text-stroke-width"},{"name":"-webkit-transform"},{"name":"-webkit-transform-origin"},{"name":"-webkit-transform-origin-x"},{"name":"-webkit-transform-origin-y"},{"name":"-webkit-transform-origin-z"},{"name":"-webkit-transform-style"},{"name":"-webkit-transition-delay"},{"name":"-webkit-transition-duration"},{"name":"-webkit-transition-property"},{"name":"-webkit-transition-timing-function"},{"name":"-webkit-user-drag"},{"name":"-webkit-user-modify"},{"name":"-webkit-user-select"},{"name":"white-space"},{"name":"widows"},{"name":"width"},{"name":"will-change"},{"name":"word-break"},{"name":"word-spacing"},{"name":"word-wrap"},{"name":"writing-mode"},{"name":"z-index"},{"name":"-webkit-border-end-color"},{"name":"-webkit-border-end-style"},{"name":"-webkit-border-end-width"},{"name":"-webkit-border-start-color"},{"name":"-webkit-border-start-style"},{"name":"-webkit-border-start-width"},{"name":"-webkit-border-before-color"},{"name":"-webkit-border-before-style"},{"name":"-webkit-border-before-width"},{"name":"-webkit-border-after-color"},{"name":"-webkit-border-after-style"},{"name":"-webkit-border-after-width"},{"name":"-webkit-margin-end"},{"name":"-webkit-margin-start"},{"name":"-webkit-margin-before"},{"name":"-webkit-margin-after"},{"name":"-webkit-padding-end"},{"name":"-webkit-padding-start"},{"name":"-webkit-padding-before"},{"name":"-webkit-padding-after"},{"name":"-webkit-logical-width"},{"name":"-webkit-logical-height"},{"name":"-webkit-min-logical-width"},{"name":"-webkit-min-logical-height"},{"name":"-webkit-max-logical-width"},{"name":"-webkit-max-logical-height"},{"name":"all"},{"name":"enable-background"},{"name":"max-zoom"},{"name":"min-zoom"},{"name":"orientation"},{"name":"page"},{"name":"src"},{"name":"transition-delay"},{"name":"transition-duration"},{"name":"transition-property"},{"name":"transition-timing-function"},{"name":"unicode-range"},{"name":"user-zoom"},{"name":"-webkit-font-size-delta"},{"name":"-webkit-text-decorations-in-effect"},{"longhands":["background-image","background-position-x","background-position-y","background-size","background-repeat-x","background-repeat-y","background-attachment","background-origin","background-clip","background-color"],"name":"background"},{"longhands":["background-position-x","background-position-y"],"name":"background-position"},{"longhands":["background-repeat-x","background-repeat-y"],"name":"background-repeat"},{"longhands":["border-top-color","border-top-style","border-top-width","border-right-color","border-right-style","border-right-width","border-bottom-color","border-bottom-style","border-bottom-width","border-left-color","border-left-style","border-left-width"],"name":"border"},{"longhands":["border-bottom-width","border-bottom-style","border-bottom-color"],"name":"border-bottom"},{"longhands":["border-top-color","border-right-color","border-bottom-color","border-left-color"],"name":"border-color"},{"longhands":["border-image-source","border-image-slice","border-image-width","border-image-outset","border-image-repeat"],"name":"border-image"},{"longhands":["border-left-width","border-left-style","border-left-color"],"name":"border-left"},{"longhands":["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"],"name":"border-radius"},{"longhands":["border-right-width","border-right-style","border-right-color"],"name":"border-right"},{"longhands":["-webkit-border-horizontal-spacing","-webkit-border-vertical-spacing"],"name":"border-spacing"},{"longhands":["border-top-style","border-right-style","border-bottom-style","border-left-style"],"name":"border-style"},{"longhands":["border-top-width","border-top-style","border-top-color"],"name":"border-top"},{"longhands":["border-top-width","border-right-width","border-bottom-width","border-left-width"],"name":"border-width"},{"longhands":["flex-grow","flex-shrink","flex-basis"],"name":"flex"},{"longhands":["flex-direction","flex-wrap"],"name":"flex-flow"},{"longhands":["font-family","font-size","font-style","font-variant","font-weight","font-stretch","line-height"],"name":"font"},{"longhands":["list-style-type","list-style-position","list-style-image"],"name":"list-style"},{"longhands":["margin-top","margin-right","margin-bottom","margin-left"],"name":"margin"},{"longhands":["marker-start","marker-mid","marker-end"],"name":"marker"},{"longhands":["outline-color","outline-style","outline-width"],"name":"outline"},{"longhands":["overflow-x","overflow-y"],"name":"overflow"},{"longhands":["padding-top","padding-right","padding-bottom","padding-left"],"name":"padding"},{"longhands":["transition-property","transition-duration","transition-timing-function","transition-delay"],"name":"transition"},{"longhands":["-webkit-animation-name","-webkit-animation-duration","-webkit-animation-timing-function","-webkit-animation-delay","-webkit-animation-iteration-count","-webkit-animation-direction","-webkit-animation-fill-mode","-webkit-animation-play-state"],"name":"-webkit-animation"},{"longhands":["-webkit-border-after-width","-webkit-border-after-style","-webkit-border-after-color"],"name":"-webkit-border-after"},{"longhands":["-webkit-border-before-width","-webkit-border-before-style","-webkit-border-before-color"],"name":"-webkit-border-before"},{"longhands":["-webkit-border-end-width","-webkit-border-end-style","-webkit-border-end-color"],"name":"-webkit-border-end"},{"longhands":["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"],"name":"-webkit-border-radius"},{"longhands":["-webkit-border-start-width","-webkit-border-start-style","-webkit-border-start-color"],"name":"-webkit-border-start"},{"longhands":["-webkit-column-rule-width","-webkit-column-rule-style","-webkit-column-rule-color"],"name":"-webkit-column-rule"},{"longhands":["-webkit-column-width","-webkit-column-count"],"name":"-webkit-columns"},{"longhands":["-webkit-margin-before-collapse","-webkit-margin-after-collapse"],"name":"-webkit-margin-collapse"},{"longhands":["-webkit-mask-image","-webkit-mask-position-x","-webkit-mask-position-y","-webkit-mask-size","-webkit-mask-repeat-x","-webkit-mask-repeat-y","-webkit-mask-origin","-webkit-mask-clip"],"name":"-webkit-mask"},{"longhands":["-webkit-mask-box-image-source","-webkit-mask-box-image-slice","-webkit-mask-box-image-width","-webkit-mask-box-image-outset","-webkit-mask-box-image-repeat"],"name":"-webkit-mask-box-image"},{"longhands":["-webkit-mask-position-x","-webkit-mask-position-y"],"name":"-webkit-mask-position"},{"longhands":["-webkit-mask-repeat-x","-webkit-mask-repeat-y"],"name":"-webkit-mask-repeat"},{"longhands":["-webkit-text-emphasis-style","-webkit-text-emphasis-color"],"name":"-webkit-text-emphasis"},{"longhands":["-webkit-text-stroke-width","-webkit-text-stroke-color"],"name":"-webkit-text-stroke"},{"longhands":["-webkit-transition-property","-webkit-transition-duration","-webkit-transition-timing-function","-webkit-transition-delay"],"name":"-webkit-transition"}]);;WebInspector.ExcludedFolderManager=function()
  4304. {WebInspector.Object.call(this);this._excludedFoldersSetting=WebInspector.settings.createSetting("workspaceExcludedFolders",{});var defaultCommonExcludedFolders=["/\\.git/","/\\.sass-cache/","/\\.hg/","/\\.idea/","/\\.svn/","/\\.cache/","/\\.project/"];var defaultWinExcludedFolders=["/Thumbs.db$","/ehthumbs.db$","/Desktop.ini$","/\\$RECYCLE.BIN/"];var defaultMacExcludedFolders=["/\\.DS_Store$","/\\.Trashes$","/\\.Spotlight-V100$","/\\.AppleDouble$","/\\.LSOverride$","/Icon$","/\\._.*$"];var defaultLinuxExcludedFolders=["/.*~$"];var defaultExcludedFolders=defaultCommonExcludedFolders;if(WebInspector.isWin())
  4305. defaultExcludedFolders=defaultExcludedFolders.concat(defaultWinExcludedFolders);else if(WebInspector.isMac())
  4306. defaultExcludedFolders=defaultExcludedFolders.concat(defaultMacExcludedFolders);else
  4307. defaultExcludedFolders=defaultExcludedFolders.concat(defaultLinuxExcludedFolders);var defaultExcludedFoldersPattern=defaultExcludedFolders.join("|");WebInspector.settings.workspaceFolderExcludePattern=WebInspector.settings.createRegExpSetting("workspaceFolderExcludePattern",defaultExcludedFoldersPattern,WebInspector.isWin()?"i":"");this._excludedFolders={};this._loadFromSettings();}
  4308. WebInspector.ExcludedFolderManager.Events={ExcludedFolderAdded:"ExcludedFolderAdded",ExcludedFolderRemoved:"ExcludedFolderRemoved"}
  4309. WebInspector.ExcludedFolderManager.prototype={_loadFromSettings:function()
  4310. {var savedExcludedFolders=this._excludedFoldersSetting.get();this._excludedFolders={};for(var fileSystemPath in savedExcludedFolders){var savedExcludedFoldersForPath=savedExcludedFolders[fileSystemPath];this._excludedFolders[fileSystemPath]=[];var excludedFolders=this._excludedFolders[fileSystemPath];for(var i=0;i<savedExcludedFoldersForPath.length;++i){var savedEntry=savedExcludedFoldersForPath[i];var entry=new WebInspector.ExcludedFolderManager.Entry(savedEntry.fileSystemPath,savedEntry.path);excludedFolders.push(entry);}}},_saveToSettings:function()
  4311. {var savedExcludedFolders=this._excludedFolders;this._excludedFoldersSetting.set(savedExcludedFolders);},addExcludedFolder:function(fileSystemPath,excludedFolderPath)
  4312. {if(!this._excludedFolders[fileSystemPath])
  4313. this._excludedFolders[fileSystemPath]=[];var entry=new WebInspector.ExcludedFolderManager.Entry(fileSystemPath,excludedFolderPath);this._excludedFolders[fileSystemPath].push(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.ExcludedFolderManager.Events.ExcludedFolderAdded,entry);},removeExcludedFolder:function(fileSystemPath,path)
  4314. {var entry=this._excludedFolderEntryForPath(fileSystemPath,path);if(!entry)
  4315. return;this._excludedFolders[fileSystemPath].remove(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.ExcludedFolderManager.Events.ExcludedFolderRemoved,entry);},removeFileSystem:function(fileSystemPath)
  4316. {delete this._excludedFolders[fileSystemPath];this._saveToSettings();},_excludedFolderEntryForPath:function(fileSystemPath,path)
  4317. {var entries=this._excludedFolders[fileSystemPath];if(!entries)
  4318. return null;for(var i=0;i<entries.length;++i){if(entries[i].path===path)
  4319. return entries[i];}
  4320. return null;},isFileExcluded:function(fileSystemPath,folderPath)
  4321. {var excludedFolders=this._excludedFolders[fileSystemPath]||[];for(var i=0;i<excludedFolders.length;++i){var entry=excludedFolders[i];if(entry.path===folderPath)
  4322. return true;}
  4323. var regex=WebInspector.settings.workspaceFolderExcludePattern.asRegExp();return regex&®ex.test(folderPath);},excludedFolders:function(fileSystemPath)
  4324. {var excludedFolders=this._excludedFolders[fileSystemPath];return excludedFolders?excludedFolders.slice():[];},__proto__:WebInspector.Object.prototype}
  4325. WebInspector.ExcludedFolderManager.Entry=function(fileSystemPath,path)
  4326. {this.fileSystemPath=fileSystemPath;this.path=path;};WebInspector.FileManager=function()
  4327. {this._saveCallbacks={};InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.SavedURL,this._savedURL,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.CanceledSaveURL,this._canceledSaveURL,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.AppendedToURL,this._appendedToURL,this);}
  4328. WebInspector.FileManager.EventTypes={SavedURL:"SavedURL",AppendedToURL:"AppendedToURL"}
  4329. WebInspector.FileManager.prototype={canSave:function()
  4330. {return true;},save:function(url,content,forceSaveAs,callback)
  4331. {var savedURLs=WebInspector.settings.savedURLs.get();delete savedURLs[url];WebInspector.settings.savedURLs.set(savedURLs);this._saveCallbacks[url]=callback||null;InspectorFrontendHost.save(url,content,forceSaveAs);},_savedURL:function(event)
  4332. {var url=(event.data);var savedURLs=WebInspector.settings.savedURLs.get();savedURLs[url]=true;WebInspector.settings.savedURLs.set(savedURLs);this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.SavedURL,url);this._invokeSaveCallback(url,true);},_invokeSaveCallback:function(url,accepted)
  4333. {var callback=this._saveCallbacks[url];delete this._saveCallbacks[url];if(callback)
  4334. callback(accepted);},_canceledSaveURL:function(event)
  4335. {var url=(event.data);this._invokeSaveCallback(url,false);},isURLSaved:function(url)
  4336. {var savedURLs=WebInspector.settings.savedURLs.get();return savedURLs[url];},append:function(url,content)
  4337. {InspectorFrontendHost.append(url,content);},close:function(url)
  4338. {},_appendedToURL:function(event)
  4339. {var url=(event.data);this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.AppendedToURL,url);},__proto__:WebInspector.Object.prototype}
  4340. WebInspector.fileManager=new WebInspector.FileManager();;WebInspector.FileSystemMapping=function()
  4341. {WebInspector.Object.call(this);this._fileSystemMappingSetting=WebInspector.settings.createSetting("fileSystemMapping",{});this._fileSystemMappings={};this._loadFromSettings();}
  4342. WebInspector.FileSystemMapping.Events={FileMappingAdded:"FileMappingAdded",FileMappingRemoved:"FileMappingRemoved"}
  4343. WebInspector.FileSystemMapping.prototype={_loadFromSettings:function()
  4344. {var savedMapping=this._fileSystemMappingSetting.get();this._fileSystemMappings={};for(var fileSystemPath in savedMapping){var savedFileSystemMappings=savedMapping[fileSystemPath];this._fileSystemMappings[fileSystemPath]=[];var fileSystemMappings=this._fileSystemMappings[fileSystemPath];for(var i=0;i<savedFileSystemMappings.length;++i){var savedEntry=savedFileSystemMappings[i];var entry=new WebInspector.FileSystemMapping.Entry(savedEntry.fileSystemPath,savedEntry.urlPrefix,savedEntry.pathPrefix);fileSystemMappings.push(entry);}}
  4345. this._rebuildIndexes();},_saveToSettings:function()
  4346. {var savedMapping=this._fileSystemMappings;this._fileSystemMappingSetting.set(savedMapping);this._rebuildIndexes();},_rebuildIndexes:function()
  4347. {this._mappingForURLPrefix={};this._urlPrefixes=[];for(var fileSystemPath in this._fileSystemMappings){var fileSystemMapping=this._fileSystemMappings[fileSystemPath];for(var i=0;i<fileSystemMapping.length;++i){var entry=fileSystemMapping[i];this._mappingForURLPrefix[entry.urlPrefix]=entry;this._urlPrefixes.push(entry.urlPrefix);}}
  4348. this._urlPrefixes.sort();},addFileSystem:function(fileSystemPath)
  4349. {if(this._fileSystemMappings[fileSystemPath])
  4350. return;this._fileSystemMappings[fileSystemPath]=[];this._saveToSettings();},removeFileSystem:function(fileSystemPath)
  4351. {if(!this._fileSystemMappings[fileSystemPath])
  4352. return;delete this._fileSystemMappings[fileSystemPath];this._saveToSettings();},addFileMapping:function(fileSystemPath,urlPrefix,pathPrefix)
  4353. {var entry=new WebInspector.FileSystemMapping.Entry(fileSystemPath,urlPrefix,pathPrefix);this._fileSystemMappings[fileSystemPath].push(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.FileMappingAdded,entry);},removeFileMapping:function(fileSystemPath,urlPrefix,pathPrefix)
  4354. {var entry=this._mappingEntryForPathPrefix(fileSystemPath,pathPrefix);if(!entry)
  4355. return;this._fileSystemMappings[fileSystemPath].remove(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.FileMappingRemoved,entry);},fileSystemPaths:function()
  4356. {return Object.keys(this._fileSystemMappings);},_mappingEntryForURL:function(url)
  4357. {for(var i=this._urlPrefixes.length-1;i>=0;--i){var urlPrefix=this._urlPrefixes[i];if(url.startsWith(urlPrefix))
  4358. return this._mappingForURLPrefix[urlPrefix];}
  4359. return null;},_mappingEntryForPath:function(fileSystemPath,filePath)
  4360. {var entries=this._fileSystemMappings[fileSystemPath];if(!entries)
  4361. return null;var entry=null;for(var i=0;i<entries.length;++i){var pathPrefix=entries[i].pathPrefix;if(entry&&entry.pathPrefix.length>pathPrefix.length)
  4362. continue;if(filePath.startsWith(pathPrefix.substr(1)))
  4363. entry=entries[i];}
  4364. return entry;},_mappingEntryForPathPrefix:function(fileSystemPath,pathPrefix)
  4365. {var entries=this._fileSystemMappings[fileSystemPath];for(var i=0;i<entries.length;++i){if(pathPrefix===entries[i].pathPrefix)
  4366. return entries[i];}
  4367. return null;},mappingEntries:function(fileSystemPath)
  4368. {return this._fileSystemMappings[fileSystemPath].slice();},hasMappingForURL:function(url)
  4369. {return!!this._mappingEntryForURL(url);},fileForURL:function(url)
  4370. {var entry=this._mappingEntryForURL(url);if(!entry)
  4371. return null;var file={};file.fileSystemPath=entry.fileSystemPath;file.filePath=entry.pathPrefix.substr(1)+url.substr(entry.urlPrefix.length);return file;},urlForPath:function(fileSystemPath,filePath)
  4372. {var entry=this._mappingEntryForPath(fileSystemPath,filePath);if(!entry)
  4373. return"";return entry.urlPrefix+filePath.substring(entry.pathPrefix.length-1);},removeMappingForURL:function(url)
  4374. {var entry=this._mappingEntryForURL(url);if(!entry)
  4375. return;this._fileSystemMappings[entry.fileSystemPath].remove(entry);this._saveToSettings();},addMappingForResource:function(url,fileSystemPath,filePath)
  4376. {var commonPathSuffixLength=0;var normalizedFilePath="/"+filePath;for(var i=0;i<normalizedFilePath.length;++i){var filePathCharacter=normalizedFilePath[normalizedFilePath.length-1-i];var urlCharacter=url[url.length-1-i];if(filePathCharacter!==urlCharacter)
  4377. break;if(filePathCharacter==="/")
  4378. commonPathSuffixLength=i;}
  4379. var pathPrefix=normalizedFilePath.substr(0,normalizedFilePath.length-commonPathSuffixLength);var urlPrefix=url.substr(0,url.length-commonPathSuffixLength);this.addFileMapping(fileSystemPath,urlPrefix,pathPrefix);},__proto__:WebInspector.Object.prototype}
  4380. WebInspector.FileSystemMapping.Entry=function(fileSystemPath,urlPrefix,pathPrefix)
  4381. {this.fileSystemPath=fileSystemPath;this.urlPrefix=urlPrefix;this.pathPrefix=pathPrefix;};WebInspector.IsolatedFileSystem=function(manager,path,name,rootURL)
  4382. {this._manager=manager;this._path=path;this._name=name;this._rootURL=rootURL;}
  4383. WebInspector.IsolatedFileSystem.errorMessage=function(error)
  4384. {return WebInspector.UIString("File system error: %s",error.message);}
  4385. WebInspector.IsolatedFileSystem.normalizePath=function(fileSystemPath)
  4386. {if(WebInspector.isWin())
  4387. return fileSystemPath.replace(/\\/g,"/");return fileSystemPath;}
  4388. WebInspector.IsolatedFileSystem.prototype={path:function()
  4389. {return this._path;},normalizedPath:function()
  4390. {if(this._normalizedPath)
  4391. return this._normalizedPath;this._normalizedPath=WebInspector.IsolatedFileSystem.normalizePath(this._path);return this._normalizedPath;},name:function()
  4392. {return this._name;},rootURL:function()
  4393. {return this._rootURL;},_requestFileSystem:function(callback)
  4394. {this._manager.requestDOMFileSystem(this._path,callback);},requestFilesRecursive:function(path,fileCallback,finishedCallback)
  4395. {var domFileSystem;var pendingRequests=0;this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
  4396. {domFileSystem=(fs);console.assert(domFileSystem);++pendingRequests;this._requestEntries(domFileSystem,path,innerCallback.bind(this));}
  4397. function innerCallback(entries)
  4398. {for(var i=0;i<entries.length;++i){var entry=entries[i];if(!entry.isDirectory){if(this._manager.excludedFolderManager().isFileExcluded(this._path,entry.fullPath))
  4399. continue;fileCallback(entry.fullPath.substr(1));}
  4400. else{if(this._manager.excludedFolderManager().isFileExcluded(this._path,entry.fullPath+"/"))
  4401. continue;++pendingRequests;this._requestEntries(domFileSystem,entry.fullPath,innerCallback.bind(this));}}
  4402. if(finishedCallback&&(--pendingRequests===0))
  4403. finishedCallback();}},createFile:function(path,name,callback)
  4404. {this._requestFileSystem(fileSystemLoaded.bind(this));var newFileIndex=1;if(!name)
  4405. name="NewFile";var nameCandidate;function fileSystemLoaded(fs)
  4406. {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getDirectory(path,null,dirEntryLoaded.bind(this),errorHandler.bind(this));}
  4407. function dirEntryLoaded(dirEntry)
  4408. {var nameCandidate=name;if(newFileIndex>1)
  4409. nameCandidate+=newFileIndex;++newFileIndex;dirEntry.getFile(nameCandidate,{create:true,exclusive:true},fileCreated,fileCreationError.bind(this));function fileCreated(entry)
  4410. {callback(entry.fullPath.substr(1));}
  4411. function fileCreationError(error)
  4412. {if(error.code===FileError.INVALID_MODIFICATION_ERR){dirEntryLoaded.call(this,dirEntry);return;}
  4413. var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when testing if file exists '"+(this._path+"/"+path+"/"+nameCandidate)+"'");callback(null);}}
  4414. function errorHandler(error)
  4415. {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);var filePath=this._path+"/"+path;if(nameCandidate)
  4416. filePath+="/"+nameCandidate;console.error(errorMessage+" when getting content for file '"+(filePath)+"'");callback(null);}},deleteFile:function(path)
  4417. {this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
  4418. {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded.bind(this),errorHandler.bind(this));}
  4419. function fileEntryLoaded(fileEntry)
  4420. {fileEntry.remove(fileEntryRemoved,errorHandler.bind(this));}
  4421. function fileEntryRemoved()
  4422. {}
  4423. function errorHandler(error)
  4424. {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when deleting file '"+(this._path+"/"+path)+"'");}},requestMetadata:function(path,callback)
  4425. {this._requestFileSystem(fileSystemLoaded);function fileSystemLoaded(fs)
  4426. {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded,errorHandler);}
  4427. function fileEntryLoaded(entry)
  4428. {entry.getMetadata(successHandler,errorHandler);}
  4429. function successHandler(metadata)
  4430. {callback(metadata.modificationTime,metadata.size);}
  4431. function errorHandler(error)
  4432. {callback(null,null);}},requestFileContent:function(path,callback)
  4433. {this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
  4434. {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded.bind(this),errorHandler.bind(this));}
  4435. function fileEntryLoaded(entry)
  4436. {entry.file(fileLoaded,errorHandler.bind(this));}
  4437. function fileLoaded(file)
  4438. {var reader=new FileReader();reader.onloadend=readerLoadEnd;reader.readAsText(file);}
  4439. function readerLoadEnd()
  4440. {var string=null;try{string=(this.result);}catch(e){console.error("Can't read file: "+path+": "+e);}
  4441. callback(string);}
  4442. function errorHandler(error)
  4443. {if(error.code===FileError.NOT_FOUND_ERR){callback(null);return;}
  4444. var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when getting content for file '"+(this._path+"/"+path)+"'");callback(null);}},setFileContent:function(path,content,callback)
  4445. {this._requestFileSystem(fileSystemLoaded.bind(this));WebInspector.userMetrics.FileSavedInWorkspace.record();function fileSystemLoaded(fs)
  4446. {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,{create:true},fileEntryLoaded.bind(this),errorHandler.bind(this));}
  4447. function fileEntryLoaded(entry)
  4448. {entry.createWriter(fileWriterCreated.bind(this),errorHandler.bind(this));}
  4449. function fileWriterCreated(fileWriter)
  4450. {fileWriter.onerror=errorHandler.bind(this);fileWriter.onwriteend=fileTruncated;fileWriter.truncate(0);function fileTruncated()
  4451. {fileWriter.onwriteend=writerEnd;var blob=new Blob([content],{type:"text/plain"});fileWriter.write(blob);}}
  4452. function writerEnd()
  4453. {callback();}
  4454. function errorHandler(error)
  4455. {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when setting content for file '"+(this._path+"/"+path)+"'");callback();}},renameFile:function(path,newName,callback)
  4456. {newName=newName?newName.trim():newName;if(!newName||newName.indexOf("/")!==-1){callback(false);return;}
  4457. var fileEntry;var dirEntry;this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
  4458. {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded.bind(this),errorHandler.bind(this));}
  4459. function fileEntryLoaded(entry)
  4460. {if(entry.name===newName){callback(false);return;}
  4461. fileEntry=entry;fileEntry.getParent(dirEntryLoaded.bind(this),errorHandler.bind(this));}
  4462. function dirEntryLoaded(entry)
  4463. {dirEntry=entry;dirEntry.getFile(newName,null,newFileEntryLoaded,newFileEntryLoadErrorHandler.bind(this));}
  4464. function newFileEntryLoaded(entry)
  4465. {callback(false);}
  4466. function newFileEntryLoadErrorHandler(error)
  4467. {if(error.code!==FileError.NOT_FOUND_ERR){callback(false);return;}
  4468. fileEntry.moveTo(dirEntry,newName,fileRenamed,errorHandler.bind(this));}
  4469. function fileRenamed(entry)
  4470. {callback(true,entry.name);}
  4471. function errorHandler(error)
  4472. {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when renaming file '"+(this._path+"/"+path)+"' to '"+newName+"'");callback(false);}},_readDirectory:function(dirEntry,callback)
  4473. {var dirReader=dirEntry.createReader();var entries=[];function innerCallback(results)
  4474. {if(!results.length)
  4475. callback(entries.sort());else{entries=entries.concat(toArray(results));dirReader.readEntries(innerCallback,errorHandler);}}
  4476. function toArray(list)
  4477. {return Array.prototype.slice.call(list||[],0);}
  4478. dirReader.readEntries(innerCallback,errorHandler);function errorHandler(error)
  4479. {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when reading directory '"+dirEntry.fullPath+"'");callback([]);}},_requestEntries:function(domFileSystem,path,callback)
  4480. {domFileSystem.root.getDirectory(path,null,innerCallback.bind(this),errorHandler);function innerCallback(dirEntry)
  4481. {this._readDirectory(dirEntry,callback);}
  4482. function errorHandler(error)
  4483. {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when requesting entry '"+path+"'");callback([]);}}};WebInspector.IsolatedFileSystemManager=function()
  4484. {this._fileSystems={};this._pendingFileSystemRequests={};this._fileSystemMapping=new WebInspector.FileSystemMapping();this._excludedFolderManager=new WebInspector.ExcludedFolderManager();this._requestFileSystems();InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.FileSystemsLoaded,this._onFileSystemsLoaded,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.FileSystemRemoved,this._onFileSystemRemoved,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.FileSystemAdded,this._onFileSystemAdded,this);}
  4485. WebInspector.IsolatedFileSystemManager.FileSystem;WebInspector.IsolatedFileSystemManager.Events={FileSystemAdded:"FileSystemAdded",FileSystemRemoved:"FileSystemRemoved"}
  4486. WebInspector.IsolatedFileSystemManager.prototype={mapping:function()
  4487. {return this._fileSystemMapping;},excludedFolderManager:function()
  4488. {return this._excludedFolderManager;},_requestFileSystems:function()
  4489. {console.assert(!this._loaded);InspectorFrontendHost.requestFileSystems();},addFileSystem:function()
  4490. {InspectorFrontendHost.addFileSystem();},removeFileSystem:function(fileSystemPath)
  4491. {InspectorFrontendHost.removeFileSystem(fileSystemPath);},_onFileSystemsLoaded:function(event)
  4492. {var fileSystems=(event.data);var addedFileSystemPaths={};for(var i=0;i<fileSystems.length;++i){this._innerAddFileSystem(fileSystems[i]);addedFileSystemPaths[fileSystems[i].fileSystemPath]=true;}
  4493. var fileSystemPaths=this._fileSystemMapping.fileSystemPaths();for(var i=0;i<fileSystemPaths.length;++i){var fileSystemPath=fileSystemPaths[i];if(!addedFileSystemPaths[fileSystemPath])
  4494. this._fileSystemRemoved(fileSystemPath);}
  4495. this._loaded=true;this._processPendingFileSystemRequests();},_innerAddFileSystem:function(fileSystem)
  4496. {var fileSystemPath=fileSystem.fileSystemPath;this._fileSystemMapping.addFileSystem(fileSystemPath);var isolatedFileSystem=new WebInspector.IsolatedFileSystem(this,fileSystemPath,fileSystem.fileSystemName,fileSystem.rootURL);this._fileSystems[fileSystemPath]=isolatedFileSystem;this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded,isolatedFileSystem);},_processPendingFileSystemRequests:function()
  4497. {for(var fileSystemPath in this._pendingFileSystemRequests){var callbacks=this._pendingFileSystemRequests[fileSystemPath];for(var i=0;i<callbacks.length;++i)
  4498. callbacks[i](this._isolatedFileSystem(fileSystemPath));}
  4499. delete this._pendingFileSystemRequests;},_onFileSystemAdded:function(event)
  4500. {var errorMessage=(event.data["errorMessage"]);var fileSystem=(event.data["fileSystem"]);if(errorMessage)
  4501. WebInspector.console.error(errorMessage,true);else
  4502. this._innerAddFileSystem(fileSystem);},_onFileSystemRemoved:function(event)
  4503. {this._fileSystemRemoved((event.data));},_fileSystemRemoved:function(fileSystemPath)
  4504. {this._fileSystemMapping.removeFileSystem(fileSystemPath);this._excludedFolderManager.removeFileSystem(fileSystemPath);var isolatedFileSystem=this._fileSystems[fileSystemPath];delete this._fileSystems[fileSystemPath];if(isolatedFileSystem)
  4505. this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved,isolatedFileSystem);},_isolatedFileSystem:function(fileSystemPath)
  4506. {var fileSystem=this._fileSystems[fileSystemPath];if(!fileSystem)
  4507. return null;if(!InspectorFrontendHost.isolatedFileSystem)
  4508. return null;return InspectorFrontendHost.isolatedFileSystem(fileSystem.name(),fileSystem.rootURL());},requestDOMFileSystem:function(fileSystemPath,callback)
  4509. {if(!this._loaded){if(!this._pendingFileSystemRequests[fileSystemPath])
  4510. this._pendingFileSystemRequests[fileSystemPath]=this._pendingFileSystemRequests[fileSystemPath]||[];this._pendingFileSystemRequests[fileSystemPath].push(callback);return;}
  4511. callback(this._isolatedFileSystem(fileSystemPath));},__proto__:WebInspector.Object.prototype}
  4512. WebInspector.isolatedFileSystemManager;;WebInspector.SearchConfig=function(query,ignoreCase,isRegex)
  4513. {this._query=query;this._ignoreCase=ignoreCase;this._isRegex=isRegex;this._parse();}
  4514. WebInspector.SearchConfig.RegexQuery;WebInspector.SearchConfig.fromPlainObject=function(object)
  4515. {return new WebInspector.SearchConfig(object.query,object.ignoreCase,object.isRegex);}
  4516. WebInspector.SearchConfig.prototype={query:function()
  4517. {return this._query;},ignoreCase:function()
  4518. {return this._ignoreCase;},isRegex:function()
  4519. {return this._isRegex;},toPlainObject:function()
  4520. {return{query:this.query(),ignoreCase:this.ignoreCase(),isRegex:this.isRegex()};},_parse:function()
  4521. {var filePattern="-?f(ile)?:(([^\\\\ ]|\\\\.)+)";var quotedPattern="\"(([^\\\\\"]|\\\\.)+)\"";var unquotedWordPattern="((?!-?f(ile)?:)[^\\\\ ]|\\\\.)+";var unquotedPattern=unquotedWordPattern+"( +"+unquotedWordPattern+")*";var pattern="("+filePattern+")|("+quotedPattern+")|("+unquotedPattern+")";var regexp=new RegExp(pattern,"g");var queryParts=this._query.match(regexp)||[];this._fileQueries=[];this._queries=[];for(var i=0;i<queryParts.length;++i){var queryPart=queryParts[i];if(!queryPart)
  4522. continue;var fileQuery=this._parseFileQuery(queryPart);if(fileQuery){this._fileQueries.push(fileQuery);this._fileRegexQueries=this._fileRegexQueries||[];this._fileRegexQueries.push({regex:new RegExp(fileQuery.text,this.ignoreCase?"i":""),isNegative:fileQuery.isNegative});continue;}
  4523. if(queryPart.startsWith("\"")){if(!queryPart.endsWith("\""))
  4524. continue;this._queries.push(this._parseQuotedQuery(queryPart));continue;}
  4525. this._queries.push(this._parseUnquotedQuery(queryPart));}},filePathMatchesFileQuery:function(filePath)
  4526. {if(!this._fileRegexQueries)
  4527. return true;for(var i=0;i<this._fileRegexQueries.length;++i){if(!!filePath.match(this._fileRegexQueries[i].regex)===this._fileRegexQueries[i].isNegative)
  4528. return false;}
  4529. return true;},queries:function()
  4530. {return this._queries;},_parseUnquotedQuery:function(query)
  4531. {return query.replace(/\\(.)/g,"$1");},_parseQuotedQuery:function(query)
  4532. {return query.substring(1,query.length-1).replace(/\\(.)/g,"$1");},_parseFileQuery:function(query)
  4533. {var match=query.match(/^(-)?f(ile)?:/);if(!match)
  4534. return null;var isNegative=!!match[1];query=query.substr(match[0].length);var result="";for(var i=0;i<query.length;++i){var char=query[i];if(char==="*"){result+=".*";}else if(char==="\\"){++i;var nextChar=query[i];if(nextChar===" ")
  4535. result+=" ";}else{if(String.regexSpecialCharacters().indexOf(query.charAt(i))!==-1)
  4536. result+="\\";result+=query.charAt(i);}}
  4537. return new WebInspector.SearchConfig.QueryTerm(result,isNegative);}}
  4538. WebInspector.SearchConfig.QueryTerm=function(text,isNegative)
  4539. {this.text=text;this.isNegative=isNegative;};WebInspector.UISourceCode=function(project,parentPath,name,originURL,url,contentType)
  4540. {this._project=project;this._parentPath=parentPath;this._name=name;this._originURL=originURL;this._url=url;this._contentType=contentType;this._requestContentCallbacks=[];this.history=[];}
  4541. WebInspector.UISourceCode.Events={WorkingCopyChanged:"WorkingCopyChanged",WorkingCopyCommitted:"WorkingCopyCommitted",TitleChanged:"TitleChanged",SavedStateUpdated:"SavedStateUpdated",SourceMappingChanged:"SourceMappingChanged",}
  4542. WebInspector.UISourceCode.prototype={networkURL:function()
  4543. {return this._url;},name:function()
  4544. {return this._name;},parentPath:function()
  4545. {return this._parentPath;},path:function()
  4546. {return this._parentPath?this._parentPath+"/"+this._name:this._name;},fullDisplayName:function()
  4547. {return this._project.displayName()+"/"+(this._parentPath?this._parentPath+"/":"")+this.displayName(true);},displayName:function(skipTrim)
  4548. {var displayName=this.name()||WebInspector.UIString("(index)");return skipTrim?displayName:displayName.trimEnd(100);},uri:function()
  4549. {var path=this.path();if(!this._project.id())
  4550. return path;if(!path)
  4551. return this._project.id();return this._project.id()+"/"+path;},originURL:function()
  4552. {return this._originURL;},canRename:function()
  4553. {return this._project.canRename();},rename:function(newName,callback)
  4554. {this._project.rename(this,newName,innerCallback.bind(this));function innerCallback(success,newName,newURL,newOriginURL,newContentType)
  4555. {if(success)
  4556. this._updateName((newName),(newURL),(newOriginURL),(newContentType));callback(success);}},remove:function()
  4557. {this._project.deleteFile(this.path());},_updateName:function(name,url,originURL,contentType)
  4558. {var oldURI=this.uri();this._name=name;if(url)
  4559. this._url=url;if(originURL)
  4560. this._originURL=originURL;if(contentType)
  4561. this._contentType=contentType;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged,oldURI);},contentURL:function()
  4562. {return this.originURL();},contentType:function()
  4563. {return this._contentType;},project:function()
  4564. {return this._project;},requestMetadata:function(callback)
  4565. {this._project.requestMetadata(this,callback);},requestContent:function(callback)
  4566. {if(this._content||this._contentLoaded){callback(this._content);return;}
  4567. this._requestContentCallbacks.push(callback);if(this._requestContentCallbacks.length===1)
  4568. this._project.requestFileContent(this,this._fireContentAvailable.bind(this));},_pushCheckContentUpdatedCallback:function(callback)
  4569. {if(!this._checkContentUpdatedCallbacks)
  4570. this._checkContentUpdatedCallbacks=[];this._checkContentUpdatedCallbacks.push(callback);},_terminateContentCheck:function()
  4571. {delete this._checkingContent;if(this._checkContentUpdatedCallbacks){this._checkContentUpdatedCallbacks.forEach(function(callback){callback();});delete this._checkContentUpdatedCallbacks;}},checkContentUpdated:function(callback)
  4572. {callback=callback||function(){};if(!this._project.canSetFileContent()){callback();return;}
  4573. this._pushCheckContentUpdatedCallback(callback);if(this._checkingContent){return;}
  4574. this._checkingContent=true;this._project.requestFileContent(this,contentLoaded.bind(this));function contentLoaded(updatedContent)
  4575. {if(updatedContent===null){var workingCopy=this.workingCopy();this._commitContent("",false);this.setWorkingCopy(workingCopy);this._terminateContentCheck();return;}
  4576. if(typeof this._lastAcceptedContent==="string"&&this._lastAcceptedContent===updatedContent){this._terminateContentCheck();return;}
  4577. if(this._content===updatedContent){delete this._lastAcceptedContent;this._terminateContentCheck();return;}
  4578. if(!this.isDirty()){this._commitContent(updatedContent,false);this._terminateContentCheck();return;}
  4579. var shouldUpdate=window.confirm(WebInspector.UIString("This file was changed externally. Would you like to reload it?"));if(shouldUpdate)
  4580. this._commitContent(updatedContent,false);else
  4581. this._lastAcceptedContent=updatedContent;this._terminateContentCheck();}},requestOriginalContent:function(callback)
  4582. {this._project.requestFileContent(this,callback);},_commitContent:function(content,shouldSetContentInProject)
  4583. {delete this._lastAcceptedContent;this._content=content;this._contentLoaded=true;var lastRevision=this.history.length?this.history[this.history.length-1]:null;if(!lastRevision||lastRevision._content!==this._content){var revision=new WebInspector.Revision(this,this._content,new Date());this.history.push(revision);}
  4584. this._innerResetWorkingCopy();this._hasCommittedChanges=true;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted);if(this._url&&WebInspector.fileManager.isURLSaved(this._url))
  4585. this._saveURLWithFileManager(false,this._content);if(shouldSetContentInProject)
  4586. this._project.setFileContent(this,this._content,function(){});},_saveURLWithFileManager:function(forceSaveAs,content)
  4587. {WebInspector.fileManager.save(this._url,(content),forceSaveAs,callback.bind(this));WebInspector.fileManager.close(this._url);function callback(accepted)
  4588. {this._savedWithFileManager=accepted;if(accepted)
  4589. this._hasCommittedChanges=false;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.SavedStateUpdated);}},save:function(forceSaveAs)
  4590. {if(this.project().type()===WebInspector.projectTypes.FileSystem||this.project().type()===WebInspector.projectTypes.Snippets){this.commitWorkingCopy();return;}
  4591. if(this.isDirty()){this._saveURLWithFileManager(forceSaveAs,this.workingCopy());this.commitWorkingCopy();return;}
  4592. this.requestContent(this._saveURLWithFileManager.bind(this,forceSaveAs));},hasUnsavedCommittedChanges:function()
  4593. {if(this._savedWithFileManager||this.project().canSetFileContent()||this._project.isServiceProject())
  4594. return false;if(this._project.workspace().hasResourceContentTrackingExtensions())
  4595. return false;return!!this._hasCommittedChanges;},addRevision:function(content)
  4596. {this._commitContent(content,true);},revertToOriginal:function()
  4597. {function callback(content)
  4598. {if(typeof content!=="string")
  4599. return;this.addRevision(content);}
  4600. this.requestOriginalContent(callback.bind(this));},revertAndClearHistory:function(callback)
  4601. {function revert(content)
  4602. {if(typeof content!=="string")
  4603. return;this.addRevision(content);this.history=[];callback(this);}
  4604. this.requestOriginalContent(revert.bind(this));},workingCopy:function()
  4605. {if(this._workingCopyGetter){this._workingCopy=this._workingCopyGetter();delete this._workingCopyGetter;}
  4606. if(this.isDirty())
  4607. return this._workingCopy;return this._content;},resetWorkingCopy:function()
  4608. {this._innerResetWorkingCopy();this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},_innerResetWorkingCopy:function()
  4609. {delete this._workingCopy;delete this._workingCopyGetter;},setWorkingCopy:function(newWorkingCopy)
  4610. {this._workingCopy=newWorkingCopy;delete this._workingCopyGetter;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},setWorkingCopyGetter:function(workingCopyGetter)
  4611. {this._workingCopyGetter=workingCopyGetter;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},removeWorkingCopyGetter:function()
  4612. {if(!this._workingCopyGetter)
  4613. return;this._workingCopy=this._workingCopyGetter();delete this._workingCopyGetter;},commitWorkingCopy:function()
  4614. {if(this.isDirty())
  4615. this._commitContent(this.workingCopy(),true);},isDirty:function()
  4616. {return typeof this._workingCopy!=="undefined"||typeof this._workingCopyGetter!=="undefined";},extension:function()
  4617. {if(this._project.type()===WebInspector.projectTypes.Network)
  4618. return this.contentType().canonicalMimeType();var lastIndexOfDot=this._name.lastIndexOf(".");var extension=lastIndexOfDot!==-1?this._name.substr(lastIndexOfDot+1):"";var indexOfQuestionMark=extension.indexOf("?");if(indexOfQuestionMark!==-1)
  4619. extension=extension.substr(0,indexOfQuestionMark);return extension;},content:function()
  4620. {return this._content;},searchInContent:function(query,caseSensitive,isRegex,callback)
  4621. {var content=this.content();if(content){WebInspector.StaticContentProvider.searchInContent(content,query,caseSensitive,isRegex,callback);return;}
  4622. this._project.searchInFileContent(this,query,caseSensitive,isRegex,callback);},_fireContentAvailable:function(content)
  4623. {this._contentLoaded=true;this._content=content;var callbacks=this._requestContentCallbacks.slice();this._requestContentCallbacks=[];for(var i=0;i<callbacks.length;++i)
  4624. callbacks[i](content);},contentLoaded:function()
  4625. {return this._contentLoaded;},uiLocation:function(lineNumber,columnNumber)
  4626. {if(typeof columnNumber==="undefined")
  4627. columnNumber=0;return new WebInspector.UILocation(this,lineNumber,columnNumber);},__proto__:WebInspector.Object.prototype}
  4628. WebInspector.UILocation=function(uiSourceCode,lineNumber,columnNumber)
  4629. {this.uiSourceCode=uiSourceCode;this.lineNumber=lineNumber;this.columnNumber=columnNumber;}
  4630. WebInspector.UILocation.prototype={linkText:function()
  4631. {var linkText=this.uiSourceCode.displayName();if(typeof this.lineNumber==="number")
  4632. linkText+=":"+(this.lineNumber+1);return linkText;},id:function()
  4633. {return this.uiSourceCode.uri()+":"+this.lineNumber+":"+this.columnNumber;},}
  4634. WebInspector.Revision=function(uiSourceCode,content,timestamp)
  4635. {this._uiSourceCode=uiSourceCode;this._content=content;this._timestamp=timestamp;}
  4636. WebInspector.Revision.prototype={get uiSourceCode()
  4637. {return this._uiSourceCode;},get timestamp()
  4638. {return this._timestamp;},get content()
  4639. {return this._content||null;},revertToThis:function()
  4640. {function revert(content)
  4641. {if(this._uiSourceCode._content!==content)
  4642. this._uiSourceCode.addRevision(content);}
  4643. this.requestContent(revert.bind(this));},contentURL:function()
  4644. {return this._uiSourceCode.originURL();},contentType:function()
  4645. {return this._uiSourceCode.contentType();},requestContent:function(callback)
  4646. {callback(this._content||"");},searchInContent:function(query,caseSensitive,isRegex,callback)
  4647. {callback([]);}};WebInspector.ProjectSearchConfig=function(){}
  4648. WebInspector.ProjectSearchConfig.prototype={query:function(){},ignoreCase:function(){},isRegex:function(){},queries:function(){},filePathMatchesFileQuery:function(filePath){}}
  4649. WebInspector.FileDescriptor=function(parentPath,name,originURL,url,contentType)
  4650. {this.parentPath=parentPath;this.name=name;this.originURL=originURL;this.url=url;this.contentType=contentType;}
  4651. WebInspector.ProjectDelegate=function(){}
  4652. WebInspector.ProjectDelegate.Events={FileAdded:"FileAdded",FileRemoved:"FileRemoved",}
  4653. WebInspector.ProjectDelegate.prototype={type:function(){},displayName:function(){},url:function(){},requestMetadata:function(path,callback){},requestFileContent:function(path,callback){},canSetFileContent:function(){},setFileContent:function(path,newContent,callback){},canRename:function(){},rename:function(path,newName,callback){},refresh:function(path,callback){},excludeFolder:function(path){},createFile:function(path,name,content,callback){},deleteFile:function(path){},remove:function(){},searchInFileContent:function(path,query,caseSensitive,isRegex,callback){},findFilesMatchingSearchRequest:function(searchConfig,filesMathingFileQuery,progress,callback){},indexContent:function(progress){}}
  4654. WebInspector.Project=function(workspace,projectId,projectDelegate)
  4655. {this._uiSourceCodesMap=new Map();this._uiSourceCodesList=[];this._workspace=workspace;this._projectId=projectId;this._projectDelegate=projectDelegate;this._url=this._projectDelegate.url();this._displayName=this._projectDelegate.displayName();projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileAdded,this._fileAdded,this);projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileRemoved,this._fileRemoved,this);}
  4656. WebInspector.Project.Events={DisplayNameUpdated:"DisplayNameUpdated"};WebInspector.Project.prototype={id:function()
  4657. {return this._projectId;},type:function()
  4658. {return this._projectDelegate.type();},displayName:function()
  4659. {return this._displayName;},setDisplayName:function(displayName)
  4660. {if(this._displayName===displayName)
  4661. return;this._displayName=displayName;this.dispatchEventToListeners(WebInspector.Project.Events.DisplayNameUpdated);},url:function()
  4662. {return this._url;},isServiceProject:function()
  4663. {return this._projectDelegate.type()===WebInspector.projectTypes.Debugger||this._projectDelegate.type()===WebInspector.projectTypes.Formatter||this._projectDelegate.type()===WebInspector.projectTypes.Service;},_fileAdded:function(event)
  4664. {var fileDescriptor=(event.data);var path=fileDescriptor.parentPath?fileDescriptor.parentPath+"/"+fileDescriptor.name:fileDescriptor.name;var uiSourceCode=this.uiSourceCode(path);if(uiSourceCode)
  4665. return;uiSourceCode=new WebInspector.UISourceCode(this,fileDescriptor.parentPath,fileDescriptor.name,fileDescriptor.originURL,fileDescriptor.url,fileDescriptor.contentType);this._uiSourceCodesMap.set(path,{uiSourceCode:uiSourceCode,index:this._uiSourceCodesList.length});this._uiSourceCodesList.push(uiSourceCode);this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeAdded,uiSourceCode);},_fileRemoved:function(event)
  4666. {var path=(event.data);this._removeFile(path);},_removeFile:function(path)
  4667. {var uiSourceCode=this.uiSourceCode(path);if(!uiSourceCode)
  4668. return;var entry=this._uiSourceCodesMap.get(path);var movedUISourceCode=this._uiSourceCodesList[this._uiSourceCodesList.length-1];this._uiSourceCodesList[entry.index]=movedUISourceCode;var movedEntry=this._uiSourceCodesMap.get(movedUISourceCode.path());movedEntry.index=entry.index;this._uiSourceCodesList.splice(this._uiSourceCodesList.length-1,1);this._uiSourceCodesMap.delete(path);this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeRemoved,entry.uiSourceCode);},_remove:function()
  4669. {this._projectDelegate.removeEventListener(WebInspector.ProjectDelegate.Events.FileAdded,this._fileAdded,this);this._projectDelegate.removeEventListener(WebInspector.ProjectDelegate.Events.FileRemoved,this._fileRemoved,this);this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectRemoved,this);this._uiSourceCodesMap=new Map();this._uiSourceCodesList=[];},workspace:function()
  4670. {return this._workspace;},uiSourceCode:function(path)
  4671. {var entry=this._uiSourceCodesMap.get(path);return entry?entry.uiSourceCode:null;},uiSourceCodeForOriginURL:function(originURL)
  4672. {for(var i=0;i<this._uiSourceCodesList.length;++i){var uiSourceCode=this._uiSourceCodesList[i];if(uiSourceCode.originURL()===originURL)
  4673. return uiSourceCode;}
  4674. return null;},uiSourceCodes:function()
  4675. {return this._uiSourceCodesList;},requestMetadata:function(uiSourceCode,callback)
  4676. {this._projectDelegate.requestMetadata(uiSourceCode.path(),callback);},requestFileContent:function(uiSourceCode,callback)
  4677. {this._projectDelegate.requestFileContent(uiSourceCode.path(),callback);},canSetFileContent:function()
  4678. {return this._projectDelegate.canSetFileContent();},setFileContent:function(uiSourceCode,newContent,callback)
  4679. {this._projectDelegate.setFileContent(uiSourceCode.path(),newContent,onSetContent.bind(this));function onSetContent(content)
  4680. {this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted,{uiSourceCode:uiSourceCode,content:newContent});callback(content);}},canRename:function()
  4681. {return this._projectDelegate.canRename();},rename:function(uiSourceCode,newName,callback)
  4682. {if(newName===uiSourceCode.name()){callback(true,uiSourceCode.name(),uiSourceCode.networkURL(),uiSourceCode.originURL(),uiSourceCode.contentType());return;}
  4683. this._projectDelegate.rename(uiSourceCode.path(),newName,innerCallback.bind(this));function innerCallback(success,newName,newURL,newOriginURL,newContentType)
  4684. {if(!success||!newName){callback(false);return;}
  4685. var oldPath=uiSourceCode.path();var newPath=uiSourceCode.parentPath()?uiSourceCode.parentPath()+"/"+newName:newName;this._uiSourceCodesMap.set(newPath,this._uiSourceCodesMap.get(oldPath));this._uiSourceCodesMap.delete(oldPath);callback(true,newName,newURL,newOriginURL,newContentType);}},refresh:function(path,callback)
  4686. {this._projectDelegate.refresh(path,callback);},excludeFolder:function(path)
  4687. {this._projectDelegate.excludeFolder(path);var uiSourceCodes=this._uiSourceCodesList.slice();for(var i=0;i<uiSourceCodes.length;++i){var uiSourceCode=uiSourceCodes[i];if(uiSourceCode.path().startsWith(path.substr(1)))
  4688. this._removeFile(uiSourceCode.path());}},createFile:function(path,name,content,callback)
  4689. {this._projectDelegate.createFile(path,name,content,innerCallback);function innerCallback(filePath)
  4690. {callback(filePath);}},deleteFile:function(path)
  4691. {this._projectDelegate.deleteFile(path);},remove:function()
  4692. {this._projectDelegate.remove();},searchInFileContent:function(uiSourceCode,query,caseSensitive,isRegex,callback)
  4693. {this._projectDelegate.searchInFileContent(uiSourceCode.path(),query,caseSensitive,isRegex,callback);},findFilesMatchingSearchRequest:function(searchConfig,filesMathingFileQuery,progress,callback)
  4694. {this._projectDelegate.findFilesMatchingSearchRequest(searchConfig,filesMathingFileQuery,progress,callback);},indexContent:function(progress)
  4695. {this._projectDelegate.indexContent(progress);},__proto__:WebInspector.Object.prototype}
  4696. WebInspector.projectTypes={Debugger:"debugger",Formatter:"formatter",Network:"network",Snippets:"snippets",FileSystem:"filesystem",ContentScripts:"contentscripts",Service:"service"}
  4697. WebInspector.Workspace=function(fileSystemMapping)
  4698. {this._fileSystemMapping=fileSystemMapping;this._projects={};this._hasResourceContentTrackingExtensions=false;}
  4699. WebInspector.Workspace.Events={UISourceCodeAdded:"UISourceCodeAdded",UISourceCodeRemoved:"UISourceCodeRemoved",UISourceCodeContentCommitted:"UISourceCodeContentCommitted",ProjectAdded:"ProjectAdded",ProjectRemoved:"ProjectRemoved"}
  4700. WebInspector.Workspace.prototype={unsavedSourceCodes:function()
  4701. {function filterUnsaved(sourceCode)
  4702. {return sourceCode.isDirty();}
  4703. var unsavedSourceCodes=[];var projects=this.projectsForType(WebInspector.projectTypes.FileSystem);for(var i=0;i<projects.length;++i)
  4704. unsavedSourceCodes=unsavedSourceCodes.concat(projects[i].uiSourceCodes().filter(filterUnsaved));return unsavedSourceCodes;},uiSourceCode:function(projectId,path)
  4705. {var project=this._projects[projectId];return project?project.uiSourceCode(path):null;},uiSourceCodeForOriginURL:function(originURL)
  4706. {var projects=this.projectsForType(WebInspector.projectTypes.Network);projects=projects.concat(this.projectsForType(WebInspector.projectTypes.ContentScripts));for(var i=0;i<projects.length;++i){var project=projects[i];var uiSourceCode=project.uiSourceCodeForOriginURL(originURL);if(uiSourceCode)
  4707. return uiSourceCode;}
  4708. return null;},uiSourceCodesForProjectType:function(type)
  4709. {var result=[];for(var projectName in this._projects){var project=this._projects[projectName];if(project.type()===type)
  4710. result=result.concat(project.uiSourceCodes());}
  4711. return result;},addProject:function(projectId,projectDelegate)
  4712. {var project=new WebInspector.Project(this,projectId,projectDelegate);this._projects[projectId]=project;this.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectAdded,project);return project;},removeProject:function(projectId)
  4713. {var project=this._projects[projectId];if(!project)
  4714. return;delete this._projects[projectId];project._remove();},project:function(projectId)
  4715. {return this._projects[projectId];},projects:function()
  4716. {return Object.values(this._projects);},projectsForType:function(type)
  4717. {function filterByType(project)
  4718. {return project.type()===type;}
  4719. return this.projects().filter(filterByType);},uiSourceCodes:function()
  4720. {var result=[];for(var projectId in this._projects){var project=this._projects[projectId];result=result.concat(project.uiSourceCodes());}
  4721. return result;},setHasResourceContentTrackingExtensions:function(hasExtensions)
  4722. {this._hasResourceContentTrackingExtensions=hasExtensions;},hasResourceContentTrackingExtensions:function()
  4723. {return this._hasResourceContentTrackingExtensions;},__proto__:WebInspector.Object.prototype}
  4724. WebInspector.workspace;;WebInspector.LiveLocation=function(updateDelegate)
  4725. {this._updateDelegate=updateDelegate;}
  4726. WebInspector.LiveLocation.prototype={update:function()
  4727. {var uiLocation=this.uiLocation();if(!uiLocation)
  4728. return;if(this._updateDelegate(uiLocation))
  4729. this.dispose();},uiLocation:function()
  4730. {throw"Not implemented";},dispose:function()
  4731. {}};WebInspector.CompilerScriptMapping=function(debuggerModel,workspace,networkMapping,networkProject,debuggerWorkspaceBinding)
  4732. {this._target=debuggerModel.target();this._debuggerModel=debuggerModel;this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);this._networkMapping=networkMapping;this._networkProject=networkProject;this._debuggerWorkspaceBinding=debuggerWorkspaceBinding;this._sourceMapForSourceMapURL={};this._pendingSourceMapLoadingCallbacks={};this._sourceMapForScriptId={};this._scriptForSourceMap=new Map();this._sourceMapForURL=new Map();this._stubUISourceCodes=new Map();this._stubProjectID="compiler-script-project";this._stubProjectDelegate=new WebInspector.ContentProviderBasedProjectDelegate(this._workspace,this._stubProjectID,WebInspector.projectTypes.Service);debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
  4733. WebInspector.CompilerScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
  4734. {var debuggerModelLocation=(rawLocation);var stubUISourceCode=this._stubUISourceCodes.get(debuggerModelLocation.scriptId);if(stubUISourceCode)
  4735. return new WebInspector.UILocation(stubUISourceCode,0,0);var sourceMap=this._sourceMapForScriptId[debuggerModelLocation.scriptId];if(!sourceMap)
  4736. return null;var lineNumber=debuggerModelLocation.lineNumber;var columnNumber=debuggerModelLocation.columnNumber||0;var entry=sourceMap.findEntry(lineNumber,columnNumber);if(!entry||entry.length===2)
  4737. return null;var url=(entry[2]);var uiSourceCode=this._networkMapping.uiSourceCodeForURL(url);if(!uiSourceCode)
  4738. return null;return uiSourceCode.uiLocation((entry[3]),(entry[4]));},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
  4739. {if(uiSourceCode.project().type()===WebInspector.projectTypes.Service)
  4740. return null;var networkURL=this._networkMapping.networkURL(uiSourceCode);if(!networkURL)
  4741. return null;var sourceMap=this._sourceMapForURL.get(networkURL);if(!sourceMap)
  4742. return null;var script=(this._scriptForSourceMap.get(sourceMap));console.assert(script);var mappingSearchLinesCount=5;var entry=sourceMap.findEntryReversed(networkURL,lineNumber,mappingSearchLinesCount);if(!entry)
  4743. return null;return this._debuggerModel.createRawLocation(script,(entry[0]),(entry[1]));},addScript:function(script)
  4744. {if(!script.sourceMapURL){script.addEventListener(WebInspector.Script.Events.SourceMapURLAdded,this._sourceMapURLAdded.bind(this));return;}
  4745. this._processScript(script);},_sourceMapURLAdded:function(event)
  4746. {var script=(event.target);if(!script.sourceMapURL)
  4747. return;this._processScript(script);},_processScript:function(script)
  4748. {var url=script.sourceURL;var splitURL=WebInspector.ParsedURL.splitURLIntoPathComponents(url);var parentPath=splitURL.slice(1,-1).join("/");var name=splitURL.peekLast()||"";var uiSourceCodePath=this._stubProjectDelegate.addContentProvider(parentPath,name,url,url,new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script,"\n\n\n\n\n// Please wait a bit.\n// Compiled script is not shown while source map is being loaded!",url));var stubUISourceCode=(this._workspace.uiSourceCode(this._stubProjectID,uiSourceCodePath));this._stubUISourceCodes.set(script.scriptId,stubUISourceCode);this._debuggerWorkspaceBinding.pushSourceMapping(script,this);this._loadSourceMapForScript(script,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
  4749. {this._stubUISourceCodes.delete(script.scriptId);this._stubProjectDelegate.removeFile(uiSourceCodePath);if(!sourceMap){this._debuggerWorkspaceBinding.updateLocations(script);return;}
  4750. if(this._scriptForSourceMap.get(sourceMap)){this._sourceMapForScriptId[script.scriptId]=sourceMap;this._debuggerWorkspaceBinding.updateLocations(script);return;}
  4751. this._sourceMapForScriptId[script.scriptId]=sourceMap;this._scriptForSourceMap.set(sourceMap,script);var sourceURLs=sourceMap.sources();var missingSources=[];for(var i=0;i<sourceURLs.length;++i){var sourceURL=sourceURLs[i];if(this._sourceMapForURL.get(sourceURL))
  4752. continue;this._sourceMapForURL.set(sourceURL,sourceMap);if(!this._networkMapping.hasMappingForURL(sourceURL)&&!this._networkMapping.uiSourceCodeForURL(sourceURL)){var contentProvider=sourceMap.sourceContentProvider(sourceURL,WebInspector.resourceTypes.Script);this._networkProject.addFileForURL(sourceURL,contentProvider,script.isContentScript());}
  4753. var uiSourceCode=this._networkMapping.uiSourceCodeForURL(sourceURL);if(uiSourceCode){this._bindUISourceCode(uiSourceCode);}else{if(missingSources.length<3)
  4754. missingSources.push(sourceURL);else if(missingSources.peekLast()!=="\u2026")
  4755. missingSources.push("\u2026");}}
  4756. if(missingSources.length){WebInspector.console.warn(WebInspector.UIString("Source map %s points to the files missing from the workspace: [%s]",sourceMap.url(),missingSources.join(", ")));}
  4757. this._debuggerWorkspaceBinding.updateLocations(script);}},isIdentity:function()
  4758. {return false;},uiLineHasMapping:function(uiSourceCode,lineNumber)
  4759. {var networkURL=this._networkMapping.networkURL(uiSourceCode);if(!networkURL)
  4760. return true;var sourceMap=this._sourceMapForURL.get(networkURL);if(!sourceMap)
  4761. return true;return!!sourceMap.findEntryReversed(networkURL,lineNumber,0);},_bindUISourceCode:function(uiSourceCode)
  4762. {this._debuggerWorkspaceBinding.setSourceMapping(this._target,uiSourceCode,this);},_unbindUISourceCode:function(uiSourceCode)
  4763. {this._debuggerWorkspaceBinding.setSourceMapping(this._target,uiSourceCode,null);},_uiSourceCodeAddedToWorkspace:function(event)
  4764. {var uiSourceCode=(event.data);var networkURL=this._networkMapping.networkURL(uiSourceCode);if(!networkURL||!this._sourceMapForURL.get(networkURL))
  4765. return;this._bindUISourceCode(uiSourceCode);},_loadSourceMapForScript:function(script,callback)
  4766. {var scriptURL=WebInspector.ParsedURL.completeURL(script.target().resourceTreeModel.inspectedPageURL(),script.sourceURL);if(!scriptURL){callback(null);return;}
  4767. console.assert(script.sourceMapURL);var scriptSourceMapURL=(script.sourceMapURL);var sourceMapURL=WebInspector.ParsedURL.completeURL(scriptURL,scriptSourceMapURL);if(!sourceMapURL){callback(null);return;}
  4768. var sourceMap=this._sourceMapForSourceMapURL[sourceMapURL];if(sourceMap){callback(sourceMap);return;}
  4769. var pendingCallbacks=this._pendingSourceMapLoadingCallbacks[sourceMapURL];if(pendingCallbacks){pendingCallbacks.push(callback);return;}
  4770. pendingCallbacks=[callback];this._pendingSourceMapLoadingCallbacks[sourceMapURL]=pendingCallbacks;WebInspector.SourceMap.load(sourceMapURL,scriptURL,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
  4771. {var url=(sourceMapURL);var callbacks=this._pendingSourceMapLoadingCallbacks[url];delete this._pendingSourceMapLoadingCallbacks[url];if(!callbacks)
  4772. return;if(sourceMap)
  4773. this._sourceMapForSourceMapURL[url]=sourceMap;for(var i=0;i<callbacks.length;++i)
  4774. callbacks[i](sourceMap);}},_debuggerReset:function()
  4775. {function unbindUISourceCodeForURL(sourceURL)
  4776. {var uiSourceCode=this._networkMapping.uiSourceCodeForURL(sourceURL);if(!uiSourceCode)
  4777. return;this._unbindUISourceCode(uiSourceCode);}
  4778. this._sourceMapForURL.keysArray().forEach(unbindUISourceCodeForURL.bind(this));this._sourceMapForSourceMapURL={};this._pendingSourceMapLoadingCallbacks={};this._sourceMapForScriptId={};this._scriptForSourceMap.clear();this._sourceMapForURL.clear();},dispose:function()
  4779. {this._workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);}};WebInspector.ResourceScriptMapping=function(debuggerModel,workspace,networkMapping,debuggerWorkspaceBinding)
  4780. {this._target=debuggerModel.target();this._debuggerModel=debuggerModel;this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);this._networkMapping=networkMapping;this._debuggerWorkspaceBinding=debuggerWorkspaceBinding;this._boundURLs=new Set();this._uiSourceCodeToScriptFile=new Map();debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
  4781. WebInspector.ResourceScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
  4782. {var debuggerModelLocation=(rawLocation);var script=debuggerModelLocation.script();var uiSourceCode=this._workspaceUISourceCodeForScript(script);if(!uiSourceCode)
  4783. return null;var scriptFile=this.scriptFile(uiSourceCode);if(scriptFile&&((scriptFile.hasDivergedFromVM()&&!scriptFile.isMergingToVM())||scriptFile.isDivergingFromVM()))
  4784. return null;var lineNumber=debuggerModelLocation.lineNumber-(script.isInlineScriptWithSourceURL()?script.lineOffset:0);var columnNumber=debuggerModelLocation.columnNumber||0;if(script.isInlineScriptWithSourceURL()&&!lineNumber&&columnNumber)
  4785. columnNumber-=script.columnOffset;return uiSourceCode.uiLocation(lineNumber,columnNumber);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
  4786. {var scripts=this._scriptsForUISourceCode(uiSourceCode);console.assert(scripts.length);var script=scripts[0];if(script.isInlineScriptWithSourceURL())
  4787. return this._debuggerModel.createRawLocation(script,lineNumber+script.lineOffset,lineNumber?columnNumber:columnNumber+script.columnOffset);return this._debuggerModel.createRawLocation(script,lineNumber,columnNumber);},addScript:function(script)
  4788. {if(script.isAnonymousScript())
  4789. return;this._debuggerWorkspaceBinding.pushSourceMapping(script,this);var uiSourceCode=this._workspaceUISourceCodeForScript(script);if(!uiSourceCode)
  4790. return;this._bindUISourceCodeToScripts(uiSourceCode,[script]);},isIdentity:function()
  4791. {return true;},uiLineHasMapping:function(uiSourceCode,lineNumber)
  4792. {return true;},scriptFile:function(uiSourceCode)
  4793. {return this._uiSourceCodeToScriptFile.get(uiSourceCode)||null;},_setScriptFile:function(uiSourceCode,scriptFile)
  4794. {if(scriptFile)
  4795. this._uiSourceCodeToScriptFile.set(uiSourceCode,scriptFile);else
  4796. this._uiSourceCodeToScriptFile.remove(uiSourceCode);},_uiSourceCodeAdded:function(event)
  4797. {var uiSourceCode=(event.data);if(!this._networkMapping.networkURL(uiSourceCode))
  4798. return;if(uiSourceCode.project().isServiceProject())
  4799. return;var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
  4800. return;this._bindUISourceCodeToScripts(uiSourceCode,scripts);},_uiSourceCodeRemoved:function(event)
  4801. {var uiSourceCode=(event.data);if(!this._networkMapping.networkURL(uiSourceCode))
  4802. return;if(uiSourceCode.project().isServiceProject())
  4803. return;this._unbindUISourceCode(uiSourceCode);},_hasMergedToVM:function(uiSourceCode)
  4804. {var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
  4805. return;for(var i=0;i<scripts.length;++i)
  4806. this._debuggerWorkspaceBinding.updateLocations(scripts[i]);},_hasDivergedFromVM:function(uiSourceCode)
  4807. {var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
  4808. return;for(var i=0;i<scripts.length;++i)
  4809. this._debuggerWorkspaceBinding.updateLocations(scripts[i]);},_workspaceUISourceCodeForScript:function(script)
  4810. {if(script.isAnonymousScript())
  4811. return null;return this._networkMapping.uiSourceCodeForURL(script.sourceURL);},_scriptsForUISourceCode:function(uiSourceCode)
  4812. {if(!this._networkMapping.networkURL(uiSourceCode))
  4813. return[];return this._debuggerModel.scriptsForSourceURL(this._networkMapping.networkURL(uiSourceCode));},_bindUISourceCodeToScripts:function(uiSourceCode,scripts)
  4814. {console.assert(scripts.length);var scriptFile=new WebInspector.ResourceScriptFile(this,uiSourceCode,scripts);this._setScriptFile(uiSourceCode,scriptFile);for(var i=0;i<scripts.length;++i)
  4815. this._debuggerWorkspaceBinding.updateLocations(scripts[i]);this._debuggerWorkspaceBinding.setSourceMapping(this._target,uiSourceCode,this);this._boundURLs.add(this._networkMapping.networkURL(uiSourceCode));},_unbindUISourceCode:function(uiSourceCode)
  4816. {var scriptFile=this.scriptFile(uiSourceCode);if(scriptFile){scriptFile.dispose();this._setScriptFile(uiSourceCode,null);}
  4817. this._debuggerWorkspaceBinding.setSourceMapping(this._target,uiSourceCode,null);},_debuggerReset:function()
  4818. {var boundURLs=this._boundURLs.valuesArray();for(var i=0;i<boundURLs.length;++i)
  4819. {var uiSourceCode=this._networkMapping.uiSourceCodeForURL(boundURLs[i]);if(!uiSourceCode)
  4820. continue;this._unbindUISourceCode(uiSourceCode);}
  4821. this._boundURLs.clear();},dispose:function()
  4822. {this._debuggerReset();this._workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);}}
  4823. WebInspector.ResourceScriptFile=function(resourceScriptMapping,uiSourceCode,scripts)
  4824. {console.assert(scripts.length);this._resourceScriptMapping=resourceScriptMapping;this._uiSourceCode=uiSourceCode;if(this._uiSourceCode.contentType()===WebInspector.resourceTypes.Script)
  4825. this._script=scripts[0];this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._update();}
  4826. WebInspector.ResourceScriptFile.Events={DidMergeToVM:"DidMergeToVM",DidDivergeFromVM:"DidDivergeFromVM",}
  4827. WebInspector.ResourceScriptFile.prototype={commitLiveEdit:function(callback)
  4828. {var target=this._resourceScriptMapping._target;function innerCallback(error,errorData)
  4829. {if(!error)
  4830. this._scriptSource=source;this._update();if(callback)
  4831. callback(error,errorData,this._script);}
  4832. if(!this._script)
  4833. return;var source=this._uiSourceCode.workingCopy();target.debuggerModel.setScriptSource(this._script.scriptId,source,innerCallback.bind(this));},_isDiverged:function()
  4834. {if(this._uiSourceCode.isDirty())
  4835. return true;if(!this._script)
  4836. return false;if(typeof this._scriptSource==="undefined")
  4837. return false;if(!this._uiSourceCode.workingCopy().startsWith(this._scriptSource))
  4838. return true;var suffix=this._uiSourceCode.workingCopy().substr(this._scriptSource.length);return!!suffix.length&&!suffix.match(WebInspector.Script.sourceURLRegex);},_workingCopyChanged:function(event)
  4839. {this._update();},_update:function()
  4840. {if(this._isDiverged()&&!this._hasDivergedFromVM)
  4841. this._divergeFromVM();else if(!this._isDiverged()&&this._hasDivergedFromVM)
  4842. this._mergeToVM();},_divergeFromVM:function()
  4843. {this._isDivergingFromVM=true;this._resourceScriptMapping._hasDivergedFromVM(this._uiSourceCode);delete this._isDivergingFromVM;this._hasDivergedFromVM=true;this.dispatchEventToListeners(WebInspector.ResourceScriptFile.Events.DidDivergeFromVM,this._uiSourceCode);},_mergeToVM:function()
  4844. {delete this._hasDivergedFromVM;this._isMergingToVM=true;this._resourceScriptMapping._hasMergedToVM(this._uiSourceCode);delete this._isMergingToVM;this.dispatchEventToListeners(WebInspector.ResourceScriptFile.Events.DidMergeToVM,this._uiSourceCode);},hasDivergedFromVM:function()
  4845. {return this._hasDivergedFromVM;},isDivergingFromVM:function()
  4846. {return this._isDivergingFromVM;},isMergingToVM:function()
  4847. {return this._isMergingToVM;},checkMapping:function()
  4848. {if(!this._script)
  4849. return;if(typeof this._scriptSource!=="undefined")
  4850. return;this._script.requestContent(callback.bind(this));function callback(source)
  4851. {this._scriptSource=source;this._update();}},target:function()
  4852. {if(!this._script)
  4853. return null;return this._script.target();},dispose:function()
  4854. {this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);},addSourceMapURL:function(sourceMapURL)
  4855. {if(!this._script)
  4856. return;this._script.addSourceMapURL(sourceMapURL);},__proto__:WebInspector.Object.prototype};WebInspector.SASSSourceMapping=function(cssModel,workspace,networkMapping,networkProject)
  4857. {this.pollPeriodMs=30*1000;this.pollIntervalMs=200;this._cssModel=cssModel;this._workspace=workspace;this._networkProject=networkProject;this._addingRevisionCounter=0;this._reset();WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.SavedURL,this._fileSaveFinished,this);WebInspector.settings.cssSourceMapsEnabled.addChangeListener(this._toggleSourceMapSupport,this);this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged,this._styleSheetChanged,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted,this._uiSourceCodeContentCommitted,this);this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._reset,this);this._networkMapping=networkMapping;}
  4858. WebInspector.SASSSourceMapping.prototype={_styleSheetChanged:function(event)
  4859. {var id=(event.data.styleSheetId);if(this._addingRevisionCounter){--this._addingRevisionCounter;return;}
  4860. var header=this._cssModel.styleSheetHeaderForId(id);if(!header)
  4861. return;this.removeHeader(header);},_toggleSourceMapSupport:function(event)
  4862. {var enabled=(event.data);var headers=this._cssModel.styleSheetHeaders();for(var i=0;i<headers.length;++i){if(enabled)
  4863. this.addHeader(headers[i]);else
  4864. this.removeHeader(headers[i]);}},_fileSaveFinished:function(event)
  4865. {var sassURL=(event.data);this._sassFileSaved(sassURL,false);},_headerValue:function(headerName,headers)
  4866. {headerName=headerName.toLowerCase();var value=null;for(var name in headers){if(name.toLowerCase()===headerName){value=headers[name];break;}}
  4867. return value;},_lastModified:function(headers)
  4868. {var lastModifiedHeader=this._headerValue("last-modified",headers);if(!lastModifiedHeader)
  4869. return null;var lastModified=new Date(lastModifiedHeader);if(isNaN(lastModified.getTime()))
  4870. return null;return lastModified;},_checkLastModified:function(headers,url)
  4871. {var lastModified=this._lastModified(headers);if(lastModified)
  4872. return lastModified;var etagMessage=this._headerValue("etag",headers)?", \"ETag\" response header found instead":"";var message=String.sprintf("The \"Last-Modified\" response header is missing or invalid for %s%s. The CSS auto-reload functionality will not work correctly.",url,etagMessage);WebInspector.console.log(message);return null;},_sassFileSaved:function(sassURL,wasLoadedFromFileSystem)
  4873. {var cssURLs=this._cssURLsForSASSURL[sassURL];if(!cssURLs)
  4874. return;if(!WebInspector.settings.cssReloadEnabled.get())
  4875. return;var sassFile=this._networkMapping.uiSourceCodeForURL(sassURL);console.assert(sassFile);if(wasLoadedFromFileSystem)
  4876. sassFile.requestMetadata(metadataReceived.bind(this));else
  4877. NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,sassURL,undefined,sassLoadedViaNetwork.bind(this));function sassLoadedViaNetwork(error,statusCode,headers,content)
  4878. {if(error||statusCode>=400){console.error("Could not load content for "+sassURL+" : "+(error||("HTTP status code: "+statusCode)));return;}
  4879. var lastModified=this._checkLastModified(headers,sassURL);if(!lastModified)
  4880. return;metadataReceived.call(this,lastModified);}
  4881. function metadataReceived(timestamp)
  4882. {if(!timestamp)
  4883. return;var now=Date.now();var deadlineMs=now+this.pollPeriodMs;var pollData=this._pollDataForSASSURL[sassURL];if(pollData){var dataByURL=pollData.dataByURL;for(var url in dataByURL)
  4884. clearTimeout(dataByURL[url].timer);}
  4885. pollData={dataByURL:{},deadlineMs:deadlineMs,sassTimestamp:timestamp};this._pollDataForSASSURL[sassURL]=pollData;for(var i=0;i<cssURLs.length;++i){pollData.dataByURL[cssURLs[i]]={previousPoll:now};this._pollCallback(cssURLs[i],sassURL,false);}}},_pollCallback:function(cssURL,sassURL,stopPolling)
  4886. {var now;var pollData=this._pollDataForSASSURL[sassURL];if(!pollData)
  4887. return;if(stopPolling){this._stopPolling(cssURL,sassURL);return;}
  4888. if((now=new Date().getTime())>pollData.deadlineMs){WebInspector.console.warn(WebInspector.UIString("%s hasn't been updated in %d seconds.",cssURL,this.pollPeriodMs/1000));this._stopPolling(cssURL,sassURL);return;}
  4889. var nextPoll=this.pollIntervalMs+pollData.dataByURL[cssURL].previousPoll;var remainingTimeoutMs=Math.max(0,nextPoll-now);pollData.dataByURL[cssURL].previousPoll=now+remainingTimeoutMs;pollData.dataByURL[cssURL].timer=setTimeout(this._reloadCSS.bind(this,cssURL,sassURL,this._pollCallback.bind(this)),remainingTimeoutMs);},_stopPolling:function(cssURL,sassURL)
  4890. {var pollData=this._pollDataForSASSURL[sassURL];delete pollData.dataByURL[cssURL];if(!Object.keys(pollData.dataByURL).length)
  4891. delete this._pollDataForSASSURL[sassURL];},_reloadCSS:function(cssURL,sassURL,callback)
  4892. {var cssUISourceCode=this._networkMapping.uiSourceCodeForURL(cssURL);if(!cssUISourceCode){WebInspector.console.warn(WebInspector.UIString("%s resource missing. Please reload the page.",cssURL));callback(cssURL,sassURL,true);return;}
  4893. if(this._networkMapping.hasMappingForURL(sassURL))
  4894. this._reloadCSSFromFileSystem(cssUISourceCode,sassURL,callback);else
  4895. this._reloadCSSFromNetwork(cssUISourceCode,sassURL,callback);},_reloadCSSFromNetwork:function(cssUISourceCode,sassURL,callback)
  4896. {var cssURL=this._networkMapping.networkURL(cssUISourceCode);var data=this._pollDataForSASSURL[sassURL];if(!data){callback(cssURL,sassURL,true);return;}
  4897. var headers={"if-modified-since":new Date(data.sassTimestamp.getTime()-1000).toUTCString()};NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,cssURL,headers,contentLoaded.bind(this));function contentLoaded(error,statusCode,headers,content)
  4898. {if(error||statusCode>=400){console.error("Could not load content for "+cssURL+" : "+(error||("HTTP status code: "+statusCode)));callback(cssURL,sassURL,true);return;}
  4899. if(!this._pollDataForSASSURL[sassURL]){callback(cssURL,sassURL,true);return;}
  4900. if(statusCode===304){callback(cssURL,sassURL,false);return;}
  4901. var lastModified=this._checkLastModified(headers,cssURL);if(!lastModified){callback(cssURL,sassURL,true);return;}
  4902. if(lastModified.getTime()<data.sassTimestamp.getTime()){callback(cssURL,sassURL,false);return;}
  4903. this._updateCSSRevision(cssUISourceCode,content,sassURL,callback);}},_updateCSSRevision:function(cssUISourceCode,content,sassURL,callback)
  4904. {++this._addingRevisionCounter;cssUISourceCode.addRevision(content);var networkURL=this._networkMapping.networkURL(cssUISourceCode);this._cssUISourceCodeUpdated(networkURL,sassURL,callback);},_reloadCSSFromFileSystem:function(cssUISourceCode,sassURL,callback)
  4905. {cssUISourceCode.requestMetadata(metadataCallback.bind(this));function metadataCallback(timestamp)
  4906. {var cssURL=this._networkMapping.networkURL(cssUISourceCode);if(!timestamp){callback(cssURL,sassURL,false);return;}
  4907. var cssTimestamp=timestamp.getTime();var pollData=this._pollDataForSASSURL[sassURL];if(!pollData){callback(cssURL,sassURL,true);return;}
  4908. if(cssTimestamp<pollData.sassTimestamp.getTime()){callback(cssURL,sassURL,false);return;}
  4909. cssUISourceCode.requestOriginalContent(contentCallback.bind(this));function contentCallback(content)
  4910. {if(content===null)
  4911. return;this._updateCSSRevision(cssUISourceCode,content,sassURL,callback);}}},_cssUISourceCodeUpdated:function(cssURL,sassURL,callback)
  4912. {var completeSourceMapURL=this._completeSourceMapURLForCSSURL[cssURL];if(!completeSourceMapURL)
  4913. return;var ids=this._cssModel.styleSheetIdsForURL(cssURL);if(!ids)
  4914. return;var headers=[];for(var i=0;i<ids.length;++i)
  4915. headers.push(this._cssModel.styleSheetHeaderForId(ids[i]));for(var i=0;i<ids.length;++i)
  4916. this._loadSourceMapAndBindUISourceCode(headers,true,completeSourceMapURL);callback(cssURL,sassURL,true);},addHeader:function(header)
  4917. {if(!header.sourceMapURL||!header.sourceURL||header.isInline||!WebInspector.settings.cssSourceMapsEnabled.get())
  4918. return;var completeSourceMapURL=WebInspector.ParsedURL.completeURL(header.sourceURL,header.sourceMapURL);if(!completeSourceMapURL)
  4919. return;this._completeSourceMapURLForCSSURL[header.sourceURL]=completeSourceMapURL;this._loadSourceMapAndBindUISourceCode([header],false,completeSourceMapURL);},removeHeader:function(header)
  4920. {var sourceURL=header.sourceURL;if(!sourceURL||!header.sourceMapURL||header.isInline||!this._completeSourceMapURLForCSSURL[sourceURL])
  4921. return;delete this._sourceMapByStyleSheetURL[sourceURL];delete this._completeSourceMapURLForCSSURL[sourceURL];for(var sassURL in this._cssURLsForSASSURL){var urls=this._cssURLsForSASSURL[sassURL];urls.remove(sourceURL);if(!urls.length)
  4922. delete this._cssURLsForSASSURL[sassURL];}
  4923. var completeSourceMapURL=WebInspector.ParsedURL.completeURL(sourceURL,header.sourceMapURL);if(completeSourceMapURL)
  4924. delete this._sourceMapByURL[completeSourceMapURL];WebInspector.cssWorkspaceBinding.updateLocations(header);},_loadSourceMapAndBindUISourceCode:function(headersWithSameSourceURL,forceRebind,completeSourceMapURL)
  4925. {console.assert(headersWithSameSourceURL.length);var sourceURL=headersWithSameSourceURL[0].sourceURL;this._loadSourceMapForStyleSheet(completeSourceMapURL,sourceURL,forceRebind,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
  4926. {if(!sourceMap)
  4927. return;this._sourceMapByStyleSheetURL[sourceURL]=sourceMap;for(var i=0;i<headersWithSameSourceURL.length;++i){if(forceRebind)
  4928. WebInspector.cssWorkspaceBinding.updateLocations(headersWithSameSourceURL[i]);else
  4929. this._bindUISourceCode(headersWithSameSourceURL[i],sourceMap);}}},_addCSSURLforSASSURL:function(cssURL,sassURL)
  4930. {var cssURLs;if(this._cssURLsForSASSURL.hasOwnProperty(sassURL))
  4931. cssURLs=this._cssURLsForSASSURL[sassURL];else{cssURLs=[];this._cssURLsForSASSURL[sassURL]=cssURLs;}
  4932. if(cssURLs.indexOf(cssURL)===-1)
  4933. cssURLs.push(cssURL);},_loadSourceMapForStyleSheet:function(completeSourceMapURL,completeStyleSheetURL,forceReload,callback)
  4934. {var sourceMap=this._sourceMapByURL[completeSourceMapURL];if(sourceMap&&!forceReload){callback(sourceMap);return;}
  4935. var pendingCallbacks=this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];if(pendingCallbacks){pendingCallbacks.push(callback);return;}
  4936. pendingCallbacks=[callback];this._pendingSourceMapLoadingCallbacks[completeSourceMapURL]=pendingCallbacks;WebInspector.SourceMap.load(completeSourceMapURL,completeStyleSheetURL,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
  4937. {var callbacks=this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];delete this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];if(!callbacks)
  4938. return;if(sourceMap)
  4939. this._sourceMapByURL[completeSourceMapURL]=sourceMap;else
  4940. delete this._sourceMapByURL[completeSourceMapURL];for(var i=0;i<callbacks.length;++i)
  4941. callbacks[i](sourceMap);}},_bindUISourceCode:function(header,sourceMap)
  4942. {WebInspector.cssWorkspaceBinding.pushSourceMapping(header,this);var rawURL=header.sourceURL;var sources=sourceMap.sources();for(var i=0;i<sources.length;++i){var url=sources[i];this._addCSSURLforSASSURL(rawURL,url);if(!this._networkMapping.hasMappingForURL(url)&&!this._networkMapping.uiSourceCodeForURL(url)){var contentProvider=sourceMap.sourceContentProvider(url,WebInspector.resourceTypes.Stylesheet);this._networkProject.addFileForURL(url,contentProvider);}}},rawLocationToUILocation:function(rawLocation)
  4943. {var entry;var sourceMap=this._sourceMapByStyleSheetURL[rawLocation.url];if(!sourceMap)
  4944. return null;entry=sourceMap.findEntry(rawLocation.lineNumber,rawLocation.columnNumber);if(!entry||entry.length===2)
  4945. return null;var uiSourceCode=this._networkMapping.uiSourceCodeForURL(entry[2]);if(!uiSourceCode)
  4946. return null;return uiSourceCode.uiLocation(entry[3],entry[4]);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
  4947. {var networkURL=this._networkMapping.networkURL(uiSourceCode);return new WebInspector.CSSLocation(this._cssModel.target(),null,networkURL||"",lineNumber,columnNumber);},isIdentity:function()
  4948. {return false;},uiLineHasMapping:function(uiSourceCode,lineNumber)
  4949. {return true;},target:function()
  4950. {return this._cssModel.target();},_uiSourceCodeAdded:function(event)
  4951. {var uiSourceCode=(event.data);var networkURL=this._networkMapping.networkURL(uiSourceCode);var cssURLs=this._cssURLsForSASSURL[networkURL];if(!cssURLs)
  4952. return;for(var i=0;i<cssURLs.length;++i){var ids=this._cssModel.styleSheetIdsForURL(cssURLs[i]);for(var j=0;j<ids.length;++j){var header=this._cssModel.styleSheetHeaderForId(ids[j]);console.assert(header);WebInspector.cssWorkspaceBinding.updateLocations((header));}}},_uiSourceCodeContentCommitted:function(event)
  4953. {var uiSourceCode=(event.data.uiSourceCode);if(uiSourceCode.project().type()===WebInspector.projectTypes.FileSystem){var networkURL=this._networkMapping.networkURL(uiSourceCode);this._sassFileSaved(networkURL,true);}},_reset:function()
  4954. {this._addingRevisionCounter=0;this._completeSourceMapURLForCSSURL={};this._cssURLsForSASSURL={};this._pendingSourceMapLoadingCallbacks={};this._pollDataForSASSURL={};this._sourceMapByURL={};this._sourceMapByStyleSheetURL={};}};WebInspector.StylesSourceMapping=function(cssModel,workspace,networkMapping)
  4955. {this._cssModel=cssModel;this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);this._networkMapping=networkMapping;cssModel.target().resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged,this._styleSheetChanged,this);this._initialize();}
  4956. WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs=1000;WebInspector.StylesSourceMapping.prototype={rawLocationToUILocation:function(rawLocation)
  4957. {var location=(rawLocation);var uiSourceCode=this._networkMapping.uiSourceCodeForURL(location.url);if(!uiSourceCode)
  4958. return null;return uiSourceCode.uiLocation(location.lineNumber,location.columnNumber);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
  4959. {var networkURL=this._networkMapping.networkURL(uiSourceCode);return new WebInspector.CSSLocation(this._cssModel.target(),null,networkURL||"",lineNumber,columnNumber);},isIdentity:function()
  4960. {return true;},uiLineHasMapping:function(uiSourceCode,lineNumber)
  4961. {return true;},target:function()
  4962. {return this._cssModel.target();},addHeader:function(header)
  4963. {var url=header.resourceURL();if(!url)
  4964. return;WebInspector.cssWorkspaceBinding.pushSourceMapping(header,this);var map=this._urlToHeadersByFrameId[url];if(!map){map=(new Map());this._urlToHeadersByFrameId[url]=map;}
  4965. var headersById=map.get(header.frameId);if(!headersById){headersById=(new Map());map.set(header.frameId,headersById);}
  4966. headersById.set(header.id,header);var uiSourceCode=this._networkMapping.uiSourceCodeForURL(url);if(uiSourceCode)
  4967. this._bindUISourceCode(uiSourceCode,header);},removeHeader:function(header)
  4968. {var url=header.resourceURL();if(!url)
  4969. return;var map=this._urlToHeadersByFrameId[url];console.assert(map);var headersById=map.get(header.frameId);console.assert(headersById);headersById.remove(header.id);if(!headersById.size){map.remove(header.frameId);if(!map.size){delete this._urlToHeadersByFrameId[url];var uiSourceCode=this._networkMapping.uiSourceCodeForURL(url);if(uiSourceCode)
  4970. this._unbindUISourceCode(uiSourceCode);}}},_unbindUISourceCode:function(uiSourceCode)
  4971. {var styleFile=this._styleFiles.get(uiSourceCode);if(!styleFile)
  4972. return;styleFile.dispose();this._styleFiles.remove(uiSourceCode);},_uiSourceCodeAddedToWorkspace:function(event)
  4973. {var uiSourceCode=(event.data);var networkURL=this._networkMapping.networkURL(uiSourceCode);if(!networkURL||!this._urlToHeadersByFrameId[networkURL])
  4974. return;this._bindUISourceCode(uiSourceCode,this._urlToHeadersByFrameId[networkURL].valuesArray()[0].valuesArray()[0]);},_bindUISourceCode:function(uiSourceCode,header)
  4975. {if(this._styleFiles.get(uiSourceCode)||header.isInline)
  4976. return;this._styleFiles.set(uiSourceCode,new WebInspector.StyleFile(uiSourceCode,this));WebInspector.cssWorkspaceBinding.updateLocations(header);},_projectRemoved:function(event)
  4977. {var project=(event.data);var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
  4978. this._unbindUISourceCode(uiSourceCodes[i]);},_uiSourceCodeRemoved:function(event)
  4979. {var uiSourceCode=(event.data);this._unbindUISourceCode(uiSourceCode);},_initialize:function()
  4980. {this._urlToHeadersByFrameId={};this._styleFiles=new Map();},_mainFrameNavigated:function(event)
  4981. {for(var url in this._urlToHeadersByFrameId){var uiSourceCode=this._networkMapping.uiSourceCodeForURL(url);if(!uiSourceCode)
  4982. continue;this._unbindUISourceCode(uiSourceCode);}
  4983. this._initialize();},_setStyleContent:function(uiSourceCode,content,majorChange,userCallback)
  4984. {var networkURL=this._networkMapping.networkURL(uiSourceCode);var styleSheetIds=this._cssModel.styleSheetIdsForURL(networkURL);if(!styleSheetIds.length){userCallback("No stylesheet found: "+networkURL);return;}
  4985. this._isSettingContent=true;function callback(error)
  4986. {userCallback(error);delete this._isSettingContent;}
  4987. this._cssModel.setStyleSheetText(styleSheetIds[0],content,majorChange,callback.bind(this));},_styleSheetChanged:function(event)
  4988. {if(this._isSettingContent)
  4989. return;if(event.data.majorChange){this._updateStyleSheetText(event.data.styleSheetId);return;}
  4990. this._updateStyleSheetTextSoon(event.data.styleSheetId);},_updateStyleSheetTextSoon:function(styleSheetId)
  4991. {if(this._updateStyleSheetTextTimer)
  4992. clearTimeout(this._updateStyleSheetTextTimer);this._updateStyleSheetTextTimer=setTimeout(this._updateStyleSheetText.bind(this,styleSheetId),WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs);},_updateStyleSheetText:function(styleSheetId)
  4993. {if(this._updateStyleSheetTextTimer){clearTimeout(this._updateStyleSheetTextTimer);delete this._updateStyleSheetTextTimer;}
  4994. var header=this._cssModel.styleSheetHeaderForId(styleSheetId);if(!header)
  4995. return;var styleSheetURL=header.resourceURL();if(!styleSheetURL)
  4996. return;var uiSourceCode=this._networkMapping.uiSourceCodeForURL(styleSheetURL);if(!uiSourceCode)
  4997. return;header.requestContent(callback.bind(this,uiSourceCode));function callback(uiSourceCode,content)
  4998. {var styleFile=this._styleFiles.get(uiSourceCode);if(styleFile)
  4999. styleFile.addRevision(content||"");}}}
  5000. WebInspector.StyleFile=function(uiSourceCode,mapping)
  5001. {this._uiSourceCode=uiSourceCode;this._mapping=mapping;this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._commitThrottler=new WebInspector.Throttler(WebInspector.StyleFile.updateTimeout);}
  5002. WebInspector.StyleFile.updateTimeout=200;WebInspector.StyleFile.prototype={_workingCopyCommitted:function(event)
  5003. {if(this._isAddingRevision)
  5004. return;this._isMajorChangePending=true;this._commitThrottler.schedule(this._commitIncrementalEdit.bind(this),true);},_workingCopyChanged:function(event)
  5005. {if(this._isAddingRevision)
  5006. return;this._commitThrottler.schedule(this._commitIncrementalEdit.bind(this),false);},_commitIncrementalEdit:function(finishCallback)
  5007. {this._mapping._setStyleContent(this._uiSourceCode,this._uiSourceCode.workingCopy(),this._isMajorChangePending,this._styleContentSet.bind(this,finishCallback));this._isMajorChangePending=false;},_styleContentSet:function(finishCallback,error)
  5008. {if(error)
  5009. WebInspector.console.error(error);finishCallback();},addRevision:function(content)
  5010. {this._isAddingRevision=true;this._uiSourceCode.addRevision(content);delete this._isAddingRevision;},dispose:function()
  5011. {this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);}};WebInspector.CSSWorkspaceBinding=function(workspace,networkMapping,networkProject)
  5012. {this._workspace=workspace;this._networkMapping=networkMapping;this._networkProject=networkProject;this._targetToTargetInfo=new Map();WebInspector.targetManager.observeTargets(this);WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameCreatedOrNavigated,this);}
  5013. WebInspector.CSSWorkspaceBinding.prototype={targetAdded:function(target)
  5014. {this._targetToTargetInfo.set(target,new WebInspector.CSSWorkspaceBinding.TargetInfo(target,this._workspace,this._networkMapping,this._networkProject));},targetRemoved:function(target)
  5015. {this._targetToTargetInfo.remove(target)._dispose();},pushSourceMapping:function(header,mapping)
  5016. {this._ensureInfoForHeader(header)._pushSourceMapping(mapping);},_headerInfo:function(header)
  5017. {var map=this._targetToTargetInfo.get(header.target());return map._headerInfo(header.id)||null;},_ensureInfoForHeader:function(header)
  5018. {var targetInfo=this._targetToTargetInfo.get(header.target());if(!targetInfo){targetInfo=new WebInspector.CSSWorkspaceBinding.TargetInfo(header.target(),this._workspace,this._networkMapping,this._networkProject);this._targetToTargetInfo.set(header.target(),targetInfo);}
  5019. return targetInfo._ensureInfoForHeader(header);},_mainFrameCreatedOrNavigated:function(event)
  5020. {var target=(event.target).target();this._targetToTargetInfo.get(target)._reset();},updateLocations:function(header)
  5021. {var info=this._headerInfo(header);if(info)
  5022. info._updateLocations();},createLiveLocation:function(rawLocation,updateDelegate)
  5023. {var header=rawLocation.styleSheetId?rawLocation.target().cssModel.styleSheetHeaderForId(rawLocation.styleSheetId):null;return new WebInspector.CSSWorkspaceBinding.LiveLocation(rawLocation.target().cssModel,header,rawLocation,this,updateDelegate);},_addLiveLocation:function(location)
  5024. {this._ensureInfoForHeader(location._header)._addLocation(location);},_removeLiveLocation:function(location)
  5025. {var info=this._headerInfo(location._header);if(info)
  5026. info._removeLocation(location);},propertyUILocation:function(cssProperty,forName)
  5027. {var style=cssProperty.ownerStyle;if(!style||!style.parentRule||!style.styleSheetId)
  5028. return null;var range=cssProperty.range;if(!range)
  5029. return null;var url=style.parentRule.resourceURL();if(!url)
  5030. return null;var line=forName?range.startLine:range.endLine;var column=forName?range.startColumn:range.endColumn-(cssProperty.text&&cssProperty.text.endsWith(";")?2:1);var rawLocation=new WebInspector.CSSLocation(style.target(),style.styleSheetId,url,line,column);return this.rawLocationToUILocation(rawLocation);},rawLocationToUILocation:function(rawLocation)
  5031. {if(!rawLocation)
  5032. return null;var cssModel=rawLocation.target().cssModel;var frameIdToSheetIds=cssModel.styleSheetIdsByFrameIdForURL(rawLocation.url);if(!Object.values(frameIdToSheetIds).length)
  5033. return null;var styleSheetIds=[];for(var frameId in frameIdToSheetIds)
  5034. styleSheetIds=styleSheetIds.concat(frameIdToSheetIds[frameId]);var uiLocation;for(var i=0;!uiLocation&&i<styleSheetIds.length;++i){var header=cssModel.styleSheetHeaderForId(styleSheetIds[i]);if(!header)
  5035. continue;var info=this._headerInfo(header);if(info)
  5036. uiLocation=info._rawLocationToUILocation(rawLocation.lineNumber,rawLocation.columnNumber);}
  5037. return uiLocation||null;}}
  5038. WebInspector.CSSWorkspaceBinding.TargetInfo=function(target,workspace,networkMapping,networkProject)
  5039. {this._target=target;var cssModel=target.cssModel;this._stylesSourceMapping=new WebInspector.StylesSourceMapping(cssModel,workspace,networkMapping);this._sassSourceMapping=new WebInspector.SASSSourceMapping(cssModel,workspace,networkMapping,networkProject);this._headerInfoById=new Map();cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);}
  5040. WebInspector.CSSWorkspaceBinding.TargetInfo.prototype={_styleSheetAdded:function(event)
  5041. {var header=(event.data);this._stylesSourceMapping.addHeader(header);this._sassSourceMapping.addHeader(header);},_styleSheetRemoved:function(event)
  5042. {var header=(event.data);this._stylesSourceMapping.removeHeader(header);this._sassSourceMapping.removeHeader(header);this._headerInfoById.remove(header.id);},_headerInfo:function(id)
  5043. {return this._headerInfoById.get(id);},_ensureInfoForHeader:function(header)
  5044. {var info=this._headerInfoById.get(header.id);if(!info){info=new WebInspector.CSSWorkspaceBinding.HeaderInfo(header);this._headerInfoById.set(header.id,info);}
  5045. return info;},_dispose:function()
  5046. {this._reset();this._target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);},_reset:function()
  5047. {this._headerInfoById.clear();}}
  5048. WebInspector.CSSWorkspaceBinding.HeaderInfo=function(header)
  5049. {this._header=header;this._sourceMappings=[];this._locations=new Set();}
  5050. WebInspector.CSSWorkspaceBinding.HeaderInfo.prototype={_addLocation:function(location)
  5051. {this._locations.add(location);location.update();},_removeLocation:function(location)
  5052. {this._locations.remove(location);},_updateLocations:function()
  5053. {var items=this._locations.valuesArray();for(var i=0;i<items.length;++i)
  5054. items[i].update();},_rawLocationToUILocation:function(lineNumber,columnNumber)
  5055. {var uiLocation=null;var rawLocation=new WebInspector.CSSLocation(this._header.target(),this._header.id,this._header.resourceURL(),lineNumber,columnNumber);for(var i=this._sourceMappings.length-1;!uiLocation&&i>=0;--i)
  5056. uiLocation=this._sourceMappings[i].rawLocationToUILocation(rawLocation);return uiLocation;},_pushSourceMapping:function(sourceMapping)
  5057. {this._sourceMappings.push(sourceMapping);this._updateLocations();}}
  5058. WebInspector.CSSWorkspaceBinding.LiveLocation=function(cssModel,header,rawLocation,binding,updateDelegate)
  5059. {WebInspector.LiveLocation.call(this,updateDelegate);this._cssModel=cssModel;this._rawLocation=rawLocation;this._binding=binding;if(!header)
  5060. this._clearStyleSheet();else
  5061. this._setStyleSheet(header);}
  5062. WebInspector.CSSWorkspaceBinding.LiveLocation.prototype={_styleSheetAdded:function(event)
  5063. {console.assert(!this._header);var header=(event.data);if(header.sourceURL&&header.sourceURL===this._rawLocation.url)
  5064. this._setStyleSheet(header);},_styleSheetRemoved:function(event)
  5065. {console.assert(this._header);var header=(event.data);if(this._header!==header)
  5066. return;this._binding._removeLiveLocation(this);this._clearStyleSheet();},_setStyleSheet:function(header)
  5067. {this._header=header;this._binding._addLiveLocation(this);this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);},_clearStyleSheet:function()
  5068. {delete this._header;this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);},uiLocation:function()
  5069. {var cssLocation=this._rawLocation;if(this._header){var headerInfo=this._binding._headerInfo(this._header);return headerInfo._rawLocationToUILocation(cssLocation.lineNumber,cssLocation.columnNumber);}
  5070. var uiSourceCode=this._binding._networkMapping.uiSourceCodeForURL(cssLocation.url);if(!uiSourceCode)
  5071. return null;return uiSourceCode.uiLocation(cssLocation.lineNumber,cssLocation.columnNumber);},dispose:function()
  5072. {WebInspector.LiveLocation.prototype.dispose.call(this);if(this._header)
  5073. this._binding._removeLiveLocation(this);this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);},__proto__:WebInspector.LiveLocation.prototype}
  5074. WebInspector.CSSSourceMapping=function()
  5075. {}
  5076. WebInspector.CSSSourceMapping.prototype={rawLocationToUILocation:function(rawLocation){},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber){},isIdentity:function(){},uiLineHasMapping:function(uiSourceCode,lineNumber){}}
  5077. WebInspector.cssWorkspaceBinding;;WebInspector.DebuggerWorkspaceBinding=function(targetManager,workspace,networkMapping,networkProject)
  5078. {this._workspace=workspace;this._networkMapping=networkMapping;this._networkProject=networkProject;this._targetToData=new Map();targetManager.observeTargets(this);targetManager.addModelListener(WebInspector.DebuggerModel,WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._globalObjectCleared,this);targetManager.addModelListener(WebInspector.DebuggerModel,WebInspector.DebuggerModel.Events.DebuggerResumed,this._debuggerResumed,this);workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved,this);}
  5079. WebInspector.DebuggerWorkspaceBinding.prototype={targetAdded:function(target)
  5080. {this._targetToData.set(target,new WebInspector.DebuggerWorkspaceBinding.TargetData(target,this));},targetRemoved:function(target)
  5081. {var targetData=this._targetToData.get(target);targetData._dispose();this._targetToData.remove(target);},_uiSourceCodeRemoved:function(event)
  5082. {var uiSourceCode=(event.data);var targetDatas=this._targetToData.valuesArray();for(var i=0;i<targetDatas.length;++i)
  5083. targetDatas[i]._uiSourceCodeRemoved(uiSourceCode);},_projectRemoved:function(event)
  5084. {var project=(event.data);var targetDatas=this._targetToData.valuesArray();var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<targetDatas.length;++i){for(var j=0;j<uiSourceCodes.length;++j)
  5085. targetDatas[i]._uiSourceCodeRemoved(uiSourceCodes[j]);}},pushSourceMapping:function(script,sourceMapping)
  5086. {var info=this._ensureInfoForScript(script);info._pushSourceMapping(sourceMapping);},popSourceMapping:function(script)
  5087. {var info=this._infoForScript(script.target(),script.scriptId);console.assert(info);return info._popSourceMapping();},setSourceMapping:function(target,uiSourceCode,sourceMapping)
  5088. {var data=this._targetToData.get(target);if(data)
  5089. data._setSourceMapping(uiSourceCode,sourceMapping);},updateLocations:function(script)
  5090. {var info=this._infoForScript(script.target(),script.scriptId);if(info)
  5091. info._updateLocations();},createLiveLocation:function(rawLocation,updateDelegate)
  5092. {var info=this._infoForScript(rawLocation.target(),rawLocation.scriptId);console.assert(info);var location=new WebInspector.DebuggerWorkspaceBinding.Location(info._script,rawLocation,this,updateDelegate);info._addLocation(location);return location;},createCallFrameLiveLocation:function(callFrame,updateDelegate)
  5093. {var target=callFrame.target();this._ensureInfoForScript(callFrame.script);var location=this.createLiveLocation(callFrame.location(),updateDelegate);this._registerCallFrameLiveLocation(target,location);return location;},rawLocationToUILocation:function(rawLocation)
  5094. {var info=this._infoForScript(rawLocation.target(),rawLocation.scriptId);console.assert(info);return info._rawLocationToUILocation(rawLocation);},uiLocationToRawLocation:function(target,uiSourceCode,lineNumber,columnNumber)
  5095. {var targetData=this._targetToData.get(target);return targetData?(targetData._uiLocationToRawLocation(uiSourceCode,lineNumber,columnNumber)):null;},uiLocationToRawLocations:function(uiSourceCode,lineNumber,columnNumber)
  5096. {var result=[];var targetDatas=this._targetToData.valuesArray();for(var i=0;i<targetDatas.length;++i){var rawLocation=targetDatas[i]._uiLocationToRawLocation(uiSourceCode,lineNumber,columnNumber);if(rawLocation)
  5097. result.push(rawLocation);}
  5098. return result;},uiLineHasMapping:function(uiSourceCode,lineNumber)
  5099. {var targetDatas=this._targetToData.valuesArray();for(var i=0;i<targetDatas.length;++i){if(!targetDatas[i]._uiLineHasMapping(uiSourceCode,lineNumber))
  5100. return false;}
  5101. return true;},scriptFile:function(uiSourceCode,target)
  5102. {var targetData=this._targetToData.get(target);return targetData?targetData._resourceMapping.scriptFile(uiSourceCode):null;},_globalObjectCleared:function(event)
  5103. {var debuggerModel=(event.target);this._reset(debuggerModel.target());},_reset:function(target)
  5104. {var targetData=this._targetToData.get(target);targetData.callFrameLocations.valuesArray().forEach(function(location){location.dispose();});targetData.callFrameLocations.clear();},_ensureInfoForScript:function(script)
  5105. {var scriptDataMap=this._targetToData.get(script.target()).scriptDataMap;var info=scriptDataMap.get(script.scriptId);if(!info){info=new WebInspector.DebuggerWorkspaceBinding.ScriptInfo(script);scriptDataMap.set(script.scriptId,info);}
  5106. return info;},_infoForScript:function(target,scriptId)
  5107. {var data=this._targetToData.get(target);if(!data)
  5108. return null;return data.scriptDataMap.get(scriptId)||null;},_registerCallFrameLiveLocation:function(target,location)
  5109. {var locations=this._targetToData.get(target).callFrameLocations;locations.add(location);},_removeLiveLocation:function(location)
  5110. {var info=this._infoForScript(location._script.target(),location._script.scriptId);if(info)
  5111. info._removeLocation(location);},_debuggerResumed:function(event)
  5112. {var debuggerModel=(event.target);this._reset(debuggerModel.target());}}
  5113. WebInspector.DebuggerWorkspaceBinding.TargetData=function(target,debuggerWorkspaceBinding)
  5114. {this._target=target;this.scriptDataMap=new Map();this.callFrameLocations=new Set();var debuggerModel=target.debuggerModel;var workspace=debuggerWorkspaceBinding._workspace;var networkMapping=debuggerWorkspaceBinding._networkMapping;this._defaultMapping=new WebInspector.DefaultScriptMapping(debuggerModel,workspace,debuggerWorkspaceBinding);this._resourceMapping=new WebInspector.ResourceScriptMapping(debuggerModel,workspace,networkMapping,debuggerWorkspaceBinding);this._compilerMapping=new WebInspector.CompilerScriptMapping(debuggerModel,workspace,networkMapping,debuggerWorkspaceBinding._networkProject,debuggerWorkspaceBinding);this._uiSourceCodeToSourceMapping=new Map();debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource,this._parsedScriptSource,this);}
  5115. WebInspector.DebuggerWorkspaceBinding.TargetData.prototype={_parsedScriptSource:function(event)
  5116. {var script=(event.data);this._defaultMapping.addScript(script);if(script.isSnippet()){WebInspector.scriptSnippetModel.addScript(script);return;}
  5117. this._resourceMapping.addScript(script);if(WebInspector.settings.jsSourceMapsEnabled.get())
  5118. this._compilerMapping.addScript(script);},_setSourceMapping:function(uiSourceCode,sourceMapping)
  5119. {if(this._uiSourceCodeToSourceMapping.get(uiSourceCode)===sourceMapping)
  5120. return;if(sourceMapping)
  5121. this._uiSourceCodeToSourceMapping.set(uiSourceCode,sourceMapping);else
  5122. this._uiSourceCodeToSourceMapping.remove(uiSourceCode);uiSourceCode.dispatchEventToListeners(WebInspector.UISourceCode.Events.SourceMappingChanged,{target:this._target,isIdentity:sourceMapping?sourceMapping.isIdentity():false});},_uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
  5123. {var sourceMapping=this._uiSourceCodeToSourceMapping.get(uiSourceCode);return sourceMapping?sourceMapping.uiLocationToRawLocation(uiSourceCode,lineNumber,columnNumber):null;},_uiLineHasMapping:function(uiSourceCode,lineNumber)
  5124. {var sourceMapping=this._uiSourceCodeToSourceMapping.get(uiSourceCode);return sourceMapping?sourceMapping.uiLineHasMapping(uiSourceCode,lineNumber):true;},_uiSourceCodeRemoved:function(uiSourceCode)
  5125. {this._uiSourceCodeToSourceMapping.remove(uiSourceCode);},_dispose:function()
  5126. {this._compilerMapping.dispose();this._resourceMapping.dispose();this._defaultMapping.dispose();this._uiSourceCodeToSourceMapping.clear();}}
  5127. WebInspector.DebuggerWorkspaceBinding.ScriptInfo=function(script)
  5128. {this._script=script;this._sourceMappings=[];this._locations=new Set();}
  5129. WebInspector.DebuggerWorkspaceBinding.ScriptInfo.prototype={_pushSourceMapping:function(sourceMapping)
  5130. {this._sourceMappings.push(sourceMapping);this._updateLocations();},_popSourceMapping:function()
  5131. {var sourceMapping=this._sourceMappings.pop();this._updateLocations();return sourceMapping;},_addLocation:function(location)
  5132. {this._locations.add(location);location.update();},_removeLocation:function(location)
  5133. {this._locations.remove(location);},_updateLocations:function()
  5134. {for(var location of this._locations)
  5135. location.update();},_rawLocationToUILocation:function(rawLocation)
  5136. {var uiLocation;for(var i=this._sourceMappings.length-1;!uiLocation&&i>=0;--i)
  5137. uiLocation=this._sourceMappings[i].rawLocationToUILocation(rawLocation);console.assert(uiLocation,"Script raw location cannot be mapped to any UI location.");return(uiLocation);}}
  5138. WebInspector.DebuggerWorkspaceBinding.Location=function(script,rawLocation,binding,updateDelegate)
  5139. {WebInspector.LiveLocation.call(this,updateDelegate);this._script=script;this._rawLocation=rawLocation;this._binding=binding;}
  5140. WebInspector.DebuggerWorkspaceBinding.Location.prototype={uiLocation:function()
  5141. {var debuggerModelLocation=this._rawLocation;return this._binding.rawLocationToUILocation(debuggerModelLocation);},dispose:function()
  5142. {WebInspector.LiveLocation.prototype.dispose.call(this);this._binding._removeLiveLocation(this);},__proto__:WebInspector.LiveLocation.prototype}
  5143. WebInspector.DebuggerSourceMapping=function()
  5144. {}
  5145. WebInspector.DebuggerSourceMapping.prototype={rawLocationToUILocation:function(rawLocation){},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber){},isIdentity:function(){},uiLineHasMapping:function(uiSourceCode,lineNumber){}}
  5146. WebInspector.debuggerWorkspaceBinding;;WebInspector.BreakpointManager=function(breakpointStorage,workspace,networkMapping,targetManager,debuggerWorkspaceBinding)
  5147. {this._storage=new WebInspector.BreakpointManager.Storage(this,breakpointStorage);this._workspace=workspace;this._networkMapping=networkMapping;this._targetManager=targetManager;this._debuggerWorkspaceBinding=debuggerWorkspaceBinding;this._breakpointsActive=true;this._breakpointsForUISourceCode=new Map();this._breakpointsForPrimaryUISourceCode=new Map();this._provisionalBreakpoints=new StringMultimap();this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);}
  5148. WebInspector.BreakpointManager.Events={BreakpointAdded:"breakpoint-added",BreakpointRemoved:"breakpoint-removed",BreakpointsActiveStateChanged:"BreakpointsActiveStateChanged"}
  5149. WebInspector.BreakpointManager._breakpointStorageId=function(sourceFileId,lineNumber,columnNumber)
  5150. {if(!sourceFileId)
  5151. return"";return sourceFileId+":"+lineNumber+":"+columnNumber;}
  5152. WebInspector.BreakpointManager.prototype={_sourceFileId:function(uiSourceCode)
  5153. {var networkURL=this._networkMapping.networkURL(uiSourceCode)
  5154. if(!networkURL)
  5155. return"";return uiSourceCode.uri();},targetAdded:function(target)
  5156. {if(!this._breakpointsActive)
  5157. target.debuggerAgent().setBreakpointsActive(this._breakpointsActive);},targetRemoved:function(target){},_provisionalBreakpointsForSourceFileId:function(sourceFileId)
  5158. {var result=new Map();var breakpoints=this._provisionalBreakpoints.get(sourceFileId).valuesArray();for(var i=0;i<breakpoints.length;++i)
  5159. result.set(breakpoints[i]._breakpointStorageId(),breakpoints[i]);return result;},removeProvisionalBreakpointsForTest:function()
  5160. {var breakpoints=this._provisionalBreakpoints.valuesArray();for(var i=0;i<breakpoints.length;++i)
  5161. breakpoints[i].remove();this._provisionalBreakpoints.clear();},_restoreBreakpoints:function(uiSourceCode)
  5162. {var sourceFileId=this._sourceFileId(uiSourceCode);if(!sourceFileId)
  5163. return;this._storage.mute();var breakpointItems=this._storage.breakpointItems(this._sourceFileId(uiSourceCode));var provisionalBreakpoints=this._provisionalBreakpointsForSourceFileId(sourceFileId);for(var i=0;i<breakpointItems.length;++i){var breakpointItem=breakpointItems[i];var itemStorageId=WebInspector.BreakpointManager._breakpointStorageId(breakpointItem.sourceFileId,breakpointItem.lineNumber,breakpointItem.columnNumber);var provisionalBreakpoint=provisionalBreakpoints.get(itemStorageId);if(provisionalBreakpoint){if(!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode))
  5164. this._breakpointsForPrimaryUISourceCode.set(uiSourceCode,[]);this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(provisionalBreakpoint);provisionalBreakpoint._updateBreakpoint();}else{this._innerSetBreakpoint(uiSourceCode,breakpointItem.lineNumber,breakpointItem.columnNumber,breakpointItem.condition,breakpointItem.enabled);}}
  5165. this._provisionalBreakpoints.removeAll(sourceFileId);this._storage.unmute();},_uiSourceCodeAdded:function(event)
  5166. {var uiSourceCode=(event.data);this._restoreBreakpoints(uiSourceCode);if(uiSourceCode.contentType()===WebInspector.resourceTypes.Script||uiSourceCode.contentType()===WebInspector.resourceTypes.Document)
  5167. uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged,this._uiSourceCodeMappingChanged,this);},_uiSourceCodeRemoved:function(event)
  5168. {var uiSourceCode=(event.data);this._removeUISourceCode(uiSourceCode);},_uiSourceCodeMappingChanged:function(event)
  5169. {var uiSourceCode=(event.target);var isIdentity=(event.data.isIdentity);var target=(event.data.target);if(isIdentity)
  5170. return;var breakpoints=this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[];for(var i=0;i<breakpoints.length;++i)
  5171. breakpoints[i]._updateInDebuggerForTarget(target);},_removeUISourceCode:function(uiSourceCode)
  5172. {var breakpoints=this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[];var sourceFileId=this._sourceFileId(uiSourceCode);for(var i=0;i<breakpoints.length;++i){breakpoints[i]._resetLocations();if(breakpoints[i].enabled())
  5173. this._provisionalBreakpoints.set(sourceFileId,breakpoints[i]);}
  5174. uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged,this._uiSourceCodeMappingChanged,this);this._breakpointsForPrimaryUISourceCode.remove(uiSourceCode);},setBreakpoint:function(uiSourceCode,lineNumber,columnNumber,condition,enabled)
  5175. {this.setBreakpointsActive(true);return this._innerSetBreakpoint(uiSourceCode,lineNumber,columnNumber,condition,enabled);},_innerSetBreakpoint:function(uiSourceCode,lineNumber,columnNumber,condition,enabled)
  5176. {var breakpoint=this.findBreakpoint(uiSourceCode,lineNumber,columnNumber);if(breakpoint){breakpoint._updateState(condition,enabled);return breakpoint;}
  5177. var projectId=uiSourceCode.project().id();var path=uiSourceCode.path();var sourceFileId=this._sourceFileId(uiSourceCode);breakpoint=new WebInspector.BreakpointManager.Breakpoint(this,projectId,path,sourceFileId,lineNumber,columnNumber,condition,enabled);if(!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode))
  5178. this._breakpointsForPrimaryUISourceCode.set(uiSourceCode,[]);this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(breakpoint);return breakpoint;},findBreakpoint:function(uiSourceCode,lineNumber,columnNumber)
  5179. {var breakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var lineBreakpoints=breakpoints?breakpoints.get(String(lineNumber)):null;var columnBreakpoints=lineBreakpoints?lineBreakpoints.get(String(columnNumber)):null;return columnBreakpoints?columnBreakpoints[0]:null;},findBreakpointOnLine:function(uiSourceCode,lineNumber)
  5180. {var breakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var lineBreakpoints=breakpoints?breakpoints.get(String(lineNumber)):null;return lineBreakpoints?lineBreakpoints.valuesArray()[0][0]:null;},breakpointsForUISourceCode:function(uiSourceCode)
  5181. {var result=[];var uiSourceCodeBreakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var breakpoints=uiSourceCodeBreakpoints?uiSourceCodeBreakpoints.valuesArray():[];for(var i=0;i<breakpoints.length;++i){var lineBreakpoints=breakpoints[i];var columnBreakpointArrays=lineBreakpoints?lineBreakpoints.valuesArray():[];result=result.concat.apply(result,columnBreakpointArrays);}
  5182. return result;},allBreakpoints:function()
  5183. {var result=[];var uiSourceCodes=this._breakpointsForUISourceCode.keysArray();for(var i=0;i<uiSourceCodes.length;++i)
  5184. result=result.concat(this.breakpointsForUISourceCode(uiSourceCodes[i]));return result;},breakpointLocationsForUISourceCode:function(uiSourceCode)
  5185. {var uiSourceCodeBreakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var lineNumbers=uiSourceCodeBreakpoints?uiSourceCodeBreakpoints.keysArray():[];var result=[];for(var i=0;i<lineNumbers.length;++i){var lineBreakpoints=uiSourceCodeBreakpoints.get(lineNumbers[i]);var columnNumbers=lineBreakpoints.keysArray();for(var j=0;j<columnNumbers.length;++j){var columnBreakpoints=lineBreakpoints.get(columnNumbers[j]);var lineNumber=parseInt(lineNumbers[i],10);var columnNumber=parseInt(columnNumbers[j],10);for(var k=0;k<columnBreakpoints.length;++k){var breakpoint=columnBreakpoints[k];var uiLocation=uiSourceCode.uiLocation(lineNumber,columnNumber);result.push({breakpoint:breakpoint,uiLocation:uiLocation});}}}
  5186. return result;},allBreakpointLocations:function()
  5187. {var result=[];var uiSourceCodes=this._breakpointsForUISourceCode.keysArray();for(var i=0;i<uiSourceCodes.length;++i)
  5188. result=result.concat(this.breakpointLocationsForUISourceCode(uiSourceCodes[i]));return result;},toggleAllBreakpoints:function(toggleState)
  5189. {var breakpoints=this.allBreakpoints();for(var i=0;i<breakpoints.length;++i)
  5190. breakpoints[i].setEnabled(toggleState);},removeAllBreakpoints:function()
  5191. {var breakpoints=this.allBreakpoints();for(var i=0;i<breakpoints.length;++i)
  5192. breakpoints[i].remove();},_projectRemoved:function(event)
  5193. {var project=(event.data);var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
  5194. this._removeUISourceCode(uiSourceCodes[i]);},_removeBreakpoint:function(breakpoint,removeFromStorage)
  5195. {var uiSourceCode=breakpoint.uiSourceCode();var breakpoints=uiSourceCode?this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[]:[];breakpoints.remove(breakpoint);if(removeFromStorage)
  5196. this._storage._removeBreakpoint(breakpoint);this._provisionalBreakpoints.remove(breakpoint._sourceFileId,breakpoint);},_uiLocationAdded:function(breakpoint,uiLocation)
  5197. {var breakpoints=this._breakpointsForUISourceCode.get(uiLocation.uiSourceCode);if(!breakpoints){breakpoints=new Map();this._breakpointsForUISourceCode.set(uiLocation.uiSourceCode,breakpoints);}
  5198. var lineBreakpoints=breakpoints.get(String(uiLocation.lineNumber));if(!lineBreakpoints){lineBreakpoints=new Map();breakpoints.set(String(uiLocation.lineNumber),lineBreakpoints);}
  5199. var columnBreakpoints=lineBreakpoints.get(String(uiLocation.columnNumber));if(!columnBreakpoints){columnBreakpoints=[];lineBreakpoints.set(String(uiLocation.columnNumber),columnBreakpoints);}
  5200. columnBreakpoints.push(breakpoint);this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.BreakpointAdded,{breakpoint:breakpoint,uiLocation:uiLocation});},_uiLocationRemoved:function(breakpoint,uiLocation)
  5201. {var breakpoints=this._breakpointsForUISourceCode.get(uiLocation.uiSourceCode);if(!breakpoints)
  5202. return;var lineBreakpoints=breakpoints.get(String(uiLocation.lineNumber));if(!lineBreakpoints)
  5203. return;var columnBreakpoints=lineBreakpoints.get(String(uiLocation.columnNumber));if(!columnBreakpoints)
  5204. return;columnBreakpoints.remove(breakpoint);if(!columnBreakpoints.length)
  5205. lineBreakpoints.remove(String(uiLocation.columnNumber));if(!lineBreakpoints.size)
  5206. breakpoints.remove(String(uiLocation.lineNumber));if(!breakpoints.size)
  5207. this._breakpointsForUISourceCode.remove(uiLocation.uiSourceCode);this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.BreakpointRemoved,{breakpoint:breakpoint,uiLocation:uiLocation});},setBreakpointsActive:function(active)
  5208. {if(this._breakpointsActive===active)
  5209. return;this._breakpointsActive=active;var targets=WebInspector.targetManager.targets();for(var i=0;i<targets.length;++i)
  5210. targets[i].debuggerAgent().setBreakpointsActive(active);this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.BreakpointsActiveStateChanged,active);},breakpointsActive:function()
  5211. {return this._breakpointsActive;},__proto__:WebInspector.Object.prototype}
  5212. WebInspector.BreakpointManager.Breakpoint=function(breakpointManager,projectId,path,sourceFileId,lineNumber,columnNumber,condition,enabled)
  5213. {this._breakpointManager=breakpointManager;this._projectId=projectId;this._path=path;this._lineNumber=lineNumber;this._columnNumber=columnNumber;this._sourceFileId=sourceFileId;this._numberOfDebuggerLocationForUILocation={};this._condition;this._enabled;this._isRemoved;this._fakePrimaryLocation;this._currentState=null;this._targetBreakpoints=new Map();this._updateState(condition,enabled);this._breakpointManager._targetManager.observeTargets(this);}
  5214. WebInspector.BreakpointManager.Breakpoint.prototype={targetAdded:function(target)
  5215. {var networkMapping=this._breakpointManager._networkMapping;var debuggerWorkspaceBinding=this._breakpointManager._debuggerWorkspaceBinding;this._targetBreakpoints.set(target,new WebInspector.BreakpointManager.TargetBreakpoint(target,this,networkMapping,debuggerWorkspaceBinding));},targetRemoved:function(target)
  5216. {var targetBreakpoint=this._targetBreakpoints.remove(target);targetBreakpoint._cleanUpAfterDebuggerIsGone();targetBreakpoint._removeEventListeners();},projectId:function()
  5217. {return this._projectId;},path:function()
  5218. {return this._path;},lineNumber:function()
  5219. {return this._lineNumber;},columnNumber:function()
  5220. {return this._columnNumber;},uiSourceCode:function()
  5221. {return this._breakpointManager._workspace.uiSourceCode(this._projectId,this._path);},_replaceUILocation:function(oldUILocation,newUILocation)
  5222. {if(this._isRemoved)
  5223. return;this._removeUILocation(oldUILocation,true);this._removeFakeBreakpointAtPrimaryLocation();if(!this._numberOfDebuggerLocationForUILocation[newUILocation.id()])
  5224. this._numberOfDebuggerLocationForUILocation[newUILocation.id()]=0;if(++this._numberOfDebuggerLocationForUILocation[newUILocation.id()]===1)
  5225. this._breakpointManager._uiLocationAdded(this,newUILocation);},_removeUILocation:function(uiLocation,muteCreationFakeBreakpoint)
  5226. {if(!uiLocation||--this._numberOfDebuggerLocationForUILocation[uiLocation.id()]!==0)
  5227. return;delete this._numberOfDebuggerLocationForUILocation[uiLocation.id()];this._breakpointManager._uiLocationRemoved(this,uiLocation);if(!muteCreationFakeBreakpoint)
  5228. this._fakeBreakpointAtPrimaryLocation();},enabled:function()
  5229. {return this._enabled;},setEnabled:function(enabled)
  5230. {this._updateState(this._condition,enabled);},condition:function()
  5231. {return this._condition;},setCondition:function(condition)
  5232. {this._updateState(condition,this._enabled);},_updateState:function(condition,enabled)
  5233. {if(this._enabled===enabled&&this._condition===condition)
  5234. return;this._enabled=enabled;this._condition=condition;this._breakpointManager._storage._updateBreakpoint(this);this._updateBreakpoint();},_updateBreakpoint:function()
  5235. {this._removeFakeBreakpointAtPrimaryLocation();this._fakeBreakpointAtPrimaryLocation();var targetBreakpoints=this._targetBreakpoints.valuesArray();for(var i=0;i<targetBreakpoints.length;++i)
  5236. targetBreakpoints[i]._scheduleUpdateInDebugger();},remove:function(keepInStorage)
  5237. {this._isRemoved=true;var removeFromStorage=!keepInStorage;this._removeFakeBreakpointAtPrimaryLocation();var targetBreakpoints=this._targetBreakpoints.valuesArray();for(var i=0;i<targetBreakpoints.length;++i){targetBreakpoints[i]._scheduleUpdateInDebugger();targetBreakpoints[i]._removeEventListeners();}
  5238. this._breakpointManager._removeBreakpoint(this,removeFromStorage);this._breakpointManager._targetManager.unobserveTargets(this);},_updateInDebuggerForTarget:function(target)
  5239. {this._targetBreakpoints.get(target)._scheduleUpdateInDebugger();},_breakpointStorageId:function()
  5240. {return WebInspector.BreakpointManager._breakpointStorageId(this._sourceFileId,this._lineNumber,this._columnNumber);},_fakeBreakpointAtPrimaryLocation:function()
  5241. {if(this._isRemoved||!Object.isEmpty(this._numberOfDebuggerLocationForUILocation)||this._fakePrimaryLocation)
  5242. return;var uiSourceCode=this._breakpointManager._workspace.uiSourceCode(this._projectId,this._path);if(!uiSourceCode)
  5243. return;this._fakePrimaryLocation=uiSourceCode.uiLocation(this._lineNumber,this._columnNumber);if(this._fakePrimaryLocation)
  5244. this._breakpointManager._uiLocationAdded(this,this._fakePrimaryLocation);},_removeFakeBreakpointAtPrimaryLocation:function()
  5245. {if(this._fakePrimaryLocation){this._breakpointManager._uiLocationRemoved(this,this._fakePrimaryLocation);delete this._fakePrimaryLocation;}},_resetLocations:function()
  5246. {this._removeFakeBreakpointAtPrimaryLocation();var targetBreakpoints=this._targetBreakpoints.valuesArray();for(var i=0;i<targetBreakpoints.length;++i)
  5247. targetBreakpoints[i]._resetLocations();}}
  5248. WebInspector.BreakpointManager.TargetBreakpoint=function(target,breakpoint,networkMapping,debuggerWorkspaceBinding)
  5249. {WebInspector.SDKObject.call(this,target);this._breakpoint=breakpoint;this._networkMapping=networkMapping;this._debuggerWorkspaceBinding=debuggerWorkspaceBinding;this._liveLocations=[];this._uiLocations={};target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled,this._cleanUpAfterDebuggerIsGone,this);target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled,this._scheduleUpdateInDebugger,this);this._hasPendingUpdate=false;this._isUpdating=false;this._cancelCallback=false;this._currentState=null;if(target.debuggerModel.debuggerEnabled())
  5250. this._scheduleUpdateInDebugger();}
  5251. WebInspector.BreakpointManager.TargetBreakpoint.prototype={_debuggerModel:function()
  5252. {return this.target().debuggerModel;},_resetLocations:function()
  5253. {var uiLocations=Object.values(this._uiLocations);for(var i=0;i<uiLocations.length;++i)
  5254. this._breakpoint._removeUILocation(uiLocations[i]);this._uiLocations={};for(var i=0;i<this._liveLocations.length;++i)
  5255. this._liveLocations[i].dispose();this._liveLocations=[];},_scheduleUpdateInDebugger:function()
  5256. {if(this._isUpdating){this._hasPendingUpdate=true;return;}
  5257. this._isUpdating=true;this._updateInDebugger(this._didUpdateInDebugger.bind(this));},_didUpdateInDebugger:function()
  5258. {this._isUpdating=false;if(this._hasPendingUpdate){this._hasPendingUpdate=false;this._scheduleUpdateInDebugger();}},_scriptDiverged:function()
  5259. {var uiSourceCode=this._breakpoint.uiSourceCode();if(!uiSourceCode)
  5260. return false;var scriptFile=this._debuggerWorkspaceBinding.scriptFile(uiSourceCode,this.target());return!!scriptFile&&scriptFile.hasDivergedFromVM();},_updateInDebugger:function(callback)
  5261. {if(this.target().isDetached()){this._cleanUpAfterDebuggerIsGone();callback();return;}
  5262. var uiSourceCode=this._breakpoint.uiSourceCode();var lineNumber=this._breakpoint._lineNumber;var columnNumber=this._breakpoint._columnNumber;var condition=this._breakpoint.condition();var debuggerLocation=uiSourceCode?this._debuggerWorkspaceBinding.uiLocationToRawLocation(this.target(),uiSourceCode,lineNumber,columnNumber):null;var newState;if(this._breakpoint._isRemoved||!this._breakpoint.enabled()||this._scriptDiverged())
  5263. newState=null;else if(debuggerLocation){var script=debuggerLocation.script();if(script.sourceURL)
  5264. newState=new WebInspector.BreakpointManager.Breakpoint.State(script.sourceURL,null,debuggerLocation.lineNumber,debuggerLocation.columnNumber,condition);else
  5265. newState=new WebInspector.BreakpointManager.Breakpoint.State(null,debuggerLocation.scriptId,debuggerLocation.lineNumber,debuggerLocation.columnNumber,condition);}else if(this._breakpoint._currentState&&this._breakpoint._currentState.url){var position=this._breakpoint._currentState;newState=new WebInspector.BreakpointManager.Breakpoint.State(position.url,null,position.lineNumber,position.columnNumber,condition);}else if(uiSourceCode){var networkURL=this._networkMapping.networkURL(uiSourceCode);if(networkURL)
  5266. newState=new WebInspector.BreakpointManager.Breakpoint.State(networkURL,null,lineNumber,columnNumber,condition);}
  5267. if(this._debuggerId&&WebInspector.BreakpointManager.Breakpoint.State.equals(newState,this._currentState)){callback();return;}
  5268. this._breakpoint._currentState=newState;if(this._debuggerId){this._resetLocations();this._debuggerModel().removeBreakpoint(this._debuggerId,this._didRemoveFromDebugger.bind(this,callback));this._scheduleUpdateInDebugger();this._currentState=null;return;}
  5269. if(!newState){callback();return;}
  5270. var updateCallback=this._didSetBreakpointInDebugger.bind(this,callback);if(newState.url)
  5271. this._debuggerModel().setBreakpointByURL(newState.url,newState.lineNumber,newState.columnNumber,this._breakpoint.condition(),updateCallback);else if(newState.scriptId)
  5272. this._debuggerModel().setBreakpointBySourceId((debuggerLocation),condition,updateCallback);this._currentState=newState;},_didSetBreakpointInDebugger:function(callback,breakpointId,locations)
  5273. {if(this._cancelCallback){this._cancelCallback=false;callback();return;}
  5274. if(!breakpointId){this._breakpoint.remove(true);callback();return;}
  5275. this._debuggerId=breakpointId;this.target().debuggerModel.addBreakpointListener(this._debuggerId,this._breakpointResolved,this);for(var i=0;i<locations.length;++i){if(!this._addResolvedLocation(locations[i]))
  5276. break;}
  5277. callback();},_didRemoveFromDebugger:function(callback)
  5278. {if(this._cancelCallback){this._cancelCallback=false;callback();return;}
  5279. this._resetLocations();this.target().debuggerModel.removeBreakpointListener(this._debuggerId,this._breakpointResolved,this);delete this._debuggerId;callback();},_breakpointResolved:function(event)
  5280. {this._addResolvedLocation((event.data));},_locationUpdated:function(location,uiLocation)
  5281. {var oldUILocation=this._uiLocations[location.id()]||null;this._uiLocations[location.id()]=uiLocation;this._breakpoint._replaceUILocation(oldUILocation,uiLocation);},_addResolvedLocation:function(location)
  5282. {var uiLocation=this._debuggerWorkspaceBinding.rawLocationToUILocation(location);var breakpoint=this._breakpoint._breakpointManager.findBreakpoint(uiLocation.uiSourceCode,uiLocation.lineNumber,uiLocation.columnNumber);if(breakpoint&&breakpoint!==this._breakpoint){this._breakpoint.remove();return false;}
  5283. this._liveLocations.push(this._debuggerWorkspaceBinding.createLiveLocation(location,this._locationUpdated.bind(this,location)));return true;},_cleanUpAfterDebuggerIsGone:function()
  5284. {if(this._isUpdating)
  5285. this._cancelCallback=true;this._resetLocations();this._currentState=null;if(this._debuggerId)
  5286. this._didRemoveFromDebugger(function(){});},_removeEventListeners:function()
  5287. {this.target().debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled,this._cleanUpAfterDebuggerIsGone,this);this.target().debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled,this._scheduleUpdateInDebugger,this);},__proto__:WebInspector.SDKObject.prototype}
  5288. WebInspector.BreakpointManager.Breakpoint.State=function(url,scriptId,lineNumber,columnNumber,condition)
  5289. {this.url=url;this.scriptId=scriptId;this.lineNumber=lineNumber;this.columnNumber=columnNumber;this.condition=condition;}
  5290. WebInspector.BreakpointManager.Breakpoint.State.equals=function(stateA,stateB)
  5291. {if(!stateA||!stateB)
  5292. return false;if(stateA.scriptId||stateB.scriptId)
  5293. return false;return stateA.url===stateB.url&&stateA.lineNumber===stateB.lineNumber&&stateA.columnNumber===stateB.columnNumber&&stateA.condition===stateB.condition;}
  5294. WebInspector.BreakpointManager.Storage=function(breakpointManager,setting)
  5295. {this._breakpointManager=breakpointManager;this._setting=setting;var breakpoints=this._setting.get();this._breakpoints={};for(var i=0;i<breakpoints.length;++i){var breakpoint=(breakpoints[i]);breakpoint.columnNumber=breakpoint.columnNumber||0;this._breakpoints[breakpoint.sourceFileId+":"+breakpoint.lineNumber+":"+breakpoint.columnNumber]=breakpoint;}}
  5296. WebInspector.BreakpointManager.Storage.prototype={mute:function()
  5297. {this._muted=true;},unmute:function()
  5298. {delete this._muted;},breakpointItems:function(sourceFileId)
  5299. {var result=[];for(var id in this._breakpoints){var breakpoint=this._breakpoints[id];if(breakpoint.sourceFileId===sourceFileId)
  5300. result.push(breakpoint);}
  5301. return result;},_updateBreakpoint:function(breakpoint)
  5302. {if(this._muted||!breakpoint._breakpointStorageId())
  5303. return;this._breakpoints[breakpoint._breakpointStorageId()]=new WebInspector.BreakpointManager.Storage.Item(breakpoint);this._save();},_removeBreakpoint:function(breakpoint)
  5304. {if(this._muted)
  5305. return;delete this._breakpoints[breakpoint._breakpointStorageId()];this._save();},_save:function()
  5306. {var breakpointsArray=[];for(var id in this._breakpoints)
  5307. breakpointsArray.push(this._breakpoints[id]);this._setting.set(breakpointsArray);}}
  5308. WebInspector.BreakpointManager.Storage.Item=function(breakpoint)
  5309. {this.sourceFileId=breakpoint._sourceFileId;this.lineNumber=breakpoint.lineNumber();this.columnNumber=breakpoint.columnNumber();this.condition=breakpoint.condition();this.enabled=breakpoint.enabled();}
  5310. WebInspector.breakpointManager;;WebInspector.ContentProviderBasedProjectDelegate=function(workspace,id,type)
  5311. {WebInspector.Object.call(this);this._type=type;this._contentProviders={};this._workspace=workspace;this._id=id;workspace.addProject(id,this);}
  5312. WebInspector.ContentProviderBasedProjectDelegate.prototype={type:function()
  5313. {return this._type;},displayName:function()
  5314. {return"";},url:function()
  5315. {return"";},requestMetadata:function(path,callback)
  5316. {callback(null,null);},requestFileContent:function(path,callback)
  5317. {var contentProvider=this._contentProviders[path];contentProvider.requestContent(callback);function innerCallback(content,encoded,mimeType)
  5318. {callback(content);}},canSetFileContent:function()
  5319. {return false;},setFileContent:function(path,newContent,callback)
  5320. {callback(null);},canRename:function()
  5321. {return false;},rename:function(path,newName,callback)
  5322. {this.performRename(path,newName,innerCallback.bind(this));function innerCallback(success,newName)
  5323. {if(success)
  5324. this._updateName(path,(newName));callback(success,newName);}},refresh:function(path,callback)
  5325. {if(callback)
  5326. callback();},excludeFolder:function(path)
  5327. {},createFile:function(path,name,content,callback)
  5328. {},deleteFile:function(path)
  5329. {},remove:function()
  5330. {},performRename:function(path,newName,callback)
  5331. {callback(false);},_updateName:function(path,newName)
  5332. {var oldPath=path;var copyOfPath=path.split("/");copyOfPath[copyOfPath.length-1]=newName;var newPath=copyOfPath.join("/");this._contentProviders[newPath]=this._contentProviders[oldPath];delete this._contentProviders[oldPath];},searchInFileContent:function(path,query,caseSensitive,isRegex,callback)
  5333. {var contentProvider=this._contentProviders[path];contentProvider.searchInContent(query,caseSensitive,isRegex,callback);},findFilesMatchingSearchRequest:function(searchConfig,filesMathingFileQuery,progress,callback)
  5334. {var result=[];var paths=filesMathingFileQuery;var totalCount=paths.length;if(totalCount===0){setTimeout(doneCallback,0);return;}
  5335. var barrier=new CallbackBarrier();progress.setTotalWork(paths.length);for(var i=0;i<paths.length;++i)
  5336. searchInContent.call(this,paths[i],barrier.createCallback(searchInContentCallback.bind(null,paths[i])));barrier.callWhenDone(doneCallback);function searchInContent(path,callback)
  5337. {var queriesToRun=searchConfig.queries().slice();searchNextQuery.call(this);function searchNextQuery()
  5338. {if(!queriesToRun.length){callback(true);return;}
  5339. var query=queriesToRun.shift();this._contentProviders[path].searchInContent(query,!searchConfig.ignoreCase(),searchConfig.isRegex(),contentCallback.bind(this));}
  5340. function contentCallback(searchMatches)
  5341. {if(!searchMatches.length){callback(false);return;}
  5342. searchNextQuery.call(this);}}
  5343. function searchInContentCallback(path,matches)
  5344. {if(matches)
  5345. result.push(path);progress.worked(1);}
  5346. function doneCallback()
  5347. {callback(result);progress.done();}},indexContent:function(progress)
  5348. {setTimeout(progress.done.bind(progress),0);},addContentProvider:function(parentPath,name,originURL,url,contentProvider)
  5349. {var path=parentPath?parentPath+"/"+name:name;if(this._contentProviders[path])
  5350. return path;var fileDescriptor=new WebInspector.FileDescriptor(parentPath,name,originURL,url,contentProvider.contentType());this._contentProviders[path]=contentProvider;this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded,fileDescriptor);return path;},removeFile:function(path)
  5351. {delete this._contentProviders[path];this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved,path);},contentProviders:function()
  5352. {return this._contentProviders;},reset:function()
  5353. {this._contentProviders={};this._workspace.removeProject(this._id);this._workspace.addProject(this._id,this);},__proto__:WebInspector.Object.prototype};WebInspector.DefaultScriptMapping=function(debuggerModel,workspace,debuggerWorkspaceBinding)
  5354. {this._debuggerModel=debuggerModel;this._debuggerWorkspaceBinding=debuggerWorkspaceBinding;this._workspace=workspace;this._projectId=WebInspector.DefaultScriptMapping.projectIdForTarget(debuggerModel.target());this._projectDelegate=new WebInspector.DebuggerProjectDelegate(this._workspace,this._projectId,WebInspector.projectTypes.Debugger);debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);this._debuggerReset();}
  5355. WebInspector.DefaultScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
  5356. {var debuggerModelLocation=(rawLocation);var script=debuggerModelLocation.script();var uiSourceCode=this._uiSourceCodeForScriptId.get(script.scriptId);var lineNumber=debuggerModelLocation.lineNumber-(script.isInlineScriptWithSourceURL()?script.lineOffset:0);var columnNumber=debuggerModelLocation.columnNumber||0;if(script.isInlineScriptWithSourceURL()&&!lineNumber&&columnNumber)
  5357. columnNumber-=script.columnOffset;return uiSourceCode.uiLocation(lineNumber,columnNumber);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
  5358. {var scriptId=this._scriptIdForUISourceCode.get(uiSourceCode);var script=this._debuggerModel.scriptForId(scriptId);if(script.isInlineScriptWithSourceURL())
  5359. return this._debuggerModel.createRawLocation(script,lineNumber+script.lineOffset,lineNumber?columnNumber:columnNumber+script.columnOffset);return this._debuggerModel.createRawLocation(script,lineNumber,columnNumber);},addScript:function(script)
  5360. {var path=this._projectDelegate.addScript(script);var uiSourceCode=this._workspace.uiSourceCode(this._projectId,path);console.assert(uiSourceCode);uiSourceCode=(uiSourceCode);this._uiSourceCodeForScriptId.set(script.scriptId,uiSourceCode);this._scriptIdForUISourceCode.set(uiSourceCode,script.scriptId);this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel.target(),uiSourceCode,this);this._debuggerWorkspaceBinding.pushSourceMapping(script,this);script.addEventListener(WebInspector.Script.Events.ScriptEdited,this._scriptEdited,this);},isIdentity:function()
  5361. {return true;},uiLineHasMapping:function(uiSourceCode,lineNumber)
  5362. {return true;},_scriptEdited:function(event)
  5363. {var script=(event.target);var content=(event.data);this._uiSourceCodeForScriptId.get(script.scriptId).addRevision(content);},_debuggerReset:function()
  5364. {this._uiSourceCodeForScriptId=new Map();this._scriptIdForUISourceCode=new Map();this._projectDelegate.reset();},dispose:function()
  5365. {this._workspace.removeProject(this._projectId);}}
  5366. WebInspector.DefaultScriptMapping.projectIdForTarget=function(target)
  5367. {return"debugger:"+target.id();}
  5368. WebInspector.DebuggerProjectDelegate=function(workspace,id,type)
  5369. {WebInspector.ContentProviderBasedProjectDelegate.call(this,workspace,id,type);}
  5370. WebInspector.DebuggerProjectDelegate.prototype={displayName:function()
  5371. {return"";},addScript:function(script)
  5372. {var contentProvider=script.isInlineScript()&&!script.hasSourceURL?new WebInspector.ConcatenatedScriptsContentProvider([script]):script;var splitURL=WebInspector.ParsedURL.splitURLIntoPathComponents(script.sourceURL);var name=splitURL[splitURL.length-1];name="VM"+script.scriptId+(name?" "+name:"");return this.addContentProvider("",name,script.sourceURL,script.sourceURL,contentProvider);},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype};WebInspector.FileSystemWorkspaceBinding=function(isolatedFileSystemManager,workspace,networkMapping)
  5373. {this._isolatedFileSystemManager=isolatedFileSystemManager;this._workspace=workspace;this._networkMapping=networkMapping;this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded,this._fileSystemAdded,this);this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved,this._fileSystemRemoved,this);this._boundFileSystems=new Map();this._callbacks={};this._progresses={};InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.IndexingTotalWorkCalculated,this._onIndexingTotalWorkCalculated,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.IndexingWorked,this._onIndexingWorked,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.IndexingDone,this._onIndexingDone,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.SearchCompleted,this._onSearchCompleted,this);}
  5374. WebInspector.FileSystemWorkspaceBinding._scriptExtensions=["js","java","coffee","ts","dart"].keySet();WebInspector.FileSystemWorkspaceBinding._styleSheetExtensions=["css","scss","sass","less"].keySet();WebInspector.FileSystemWorkspaceBinding._documentExtensions=["htm","html","asp","aspx","phtml","jsp"].keySet();WebInspector.FileSystemWorkspaceBinding._lastRequestId=0;WebInspector.FileSystemWorkspaceBinding.projectId=function(fileSystemPath)
  5375. {return"filesystem:"+fileSystemPath;}
  5376. WebInspector.FileSystemWorkspaceBinding.prototype={_fileSystemAdded:function(event)
  5377. {var fileSystem=(event.data);var boundFileSystem=new WebInspector.FileSystemWorkspaceBinding.FileSystem(this,fileSystem,this._workspace,this._networkMapping);this._boundFileSystems.set(fileSystem.normalizedPath(),boundFileSystem);},_fileSystemRemoved:function(event)
  5378. {var fileSystem=(event.data);var boundFileSystem=this._boundFileSystems.get(fileSystem.normalizedPath());boundFileSystem.dispose();this._boundFileSystems.remove(fileSystem.normalizedPath());},fileSystemPath:function(projectId)
  5379. {var fileSystemPath=projectId.substr("filesystem:".length);var normalizedPath=WebInspector.IsolatedFileSystem.normalizePath(fileSystemPath);return projectId.substr("filesystem:".length);},_nextId:function()
  5380. {return++WebInspector.FileSystemWorkspaceBinding._lastRequestId;},registerCallback:function(callback)
  5381. {var requestId=this._nextId();this._callbacks[requestId]=callback;return requestId;},registerProgress:function(progress)
  5382. {var requestId=this._nextId();this._progresses[requestId]=progress;return requestId;},_onIndexingTotalWorkCalculated:function(event)
  5383. {var requestId=(event.data["requestId"]);var totalWork=(event.data["totalWork"]);var progress=this._progresses[requestId];if(!progress)
  5384. return;progress.setTotalWork(totalWork);},_onIndexingWorked:function(event)
  5385. {var requestId=(event.data["requestId"]);var worked=(event.data["worked"]);var progress=this._progresses[requestId];if(!progress)
  5386. return;progress.worked(worked);},_onIndexingDone:function(event)
  5387. {var requestId=(event.data["requestId"]);var progress=this._progresses[requestId];if(!progress)
  5388. return;progress.done();delete this._progresses[requestId];},_onSearchCompleted:function(event)
  5389. {var requestId=(event.data["requestId"]);var files=(event.data["files"]);var callback=this._callbacks[requestId];if(!callback)
  5390. return;callback.call(null,files);delete this._callbacks[requestId];},}
  5391. WebInspector.FileSystemWorkspaceBinding.FileSystem=function(fileSystemWorkspaceBinding,isolatedFileSystem,workspace,networkMapping)
  5392. {WebInspector.Object.call(this);this._fileSystemWorkspaceBinding=fileSystemWorkspaceBinding;this._fileSystem=isolatedFileSystem;this._fileSystemURL="file://"+this._fileSystem.normalizedPath()+"/";this._workspace=workspace;this._networkMapping=networkMapping;this._projectId=WebInspector.FileSystemWorkspaceBinding.projectId(this._fileSystem.path());console.assert(!this._workspace.project(this._projectId));this._workspace.addProject(this._projectId,this);this.populate();}
  5393. WebInspector.FileSystemWorkspaceBinding.FileSystem.prototype={type:function()
  5394. {return WebInspector.projectTypes.FileSystem;},fileSystemPath:function()
  5395. {return this._fileSystem.path();},displayName:function()
  5396. {var normalizedPath=this._fileSystem.normalizedPath();return normalizedPath.substr(normalizedPath.lastIndexOf("/")+1);},url:function()
  5397. {return"";},_filePathForPath:function(path)
  5398. {return"/"+path;},requestFileContent:function(path,callback)
  5399. {var filePath=this._filePathForPath(path);this._fileSystem.requestFileContent(filePath,callback);},requestMetadata:function(path,callback)
  5400. {var filePath=this._filePathForPath(path);this._fileSystem.requestMetadata(filePath,callback);},canSetFileContent:function()
  5401. {return true;},setFileContent:function(path,newContent,callback)
  5402. {var filePath=this._filePathForPath(path);this._fileSystem.setFileContent(filePath,newContent,callback.bind(this,""));},canRename:function()
  5403. {return true;},rename:function(path,newName,callback)
  5404. {var filePath=this._filePathForPath(path);this._fileSystem.renameFile(filePath,newName,innerCallback.bind(this));function innerCallback(success,newName)
  5405. {if(!success){callback(false,newName);return;}
  5406. var validNewName=(newName);console.assert(validNewName);var slash=filePath.lastIndexOf("/");var parentPath=filePath.substring(0,slash);filePath=parentPath+"/"+validNewName;filePath=filePath.substr(1);var newURL=this._networkMapping.urlForPath(this._fileSystem.path(),filePath);var extension=this._extensionForPath(validNewName);var newOriginURL=this._fileSystemURL+filePath;var newContentType=this._contentTypeForExtension(extension);callback(true,validNewName,newURL,newOriginURL,newContentType);}},searchInFileContent:function(path,query,caseSensitive,isRegex,callback)
  5407. {var filePath=this._filePathForPath(path);this._fileSystem.requestFileContent(filePath,contentCallback);function contentCallback(content)
  5408. {var result=[];if(content!==null)
  5409. result=WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex);callback(result);}},findFilesMatchingSearchRequest:function(searchConfig,filesMathingFileQuery,progress,callback)
  5410. {var result=filesMathingFileQuery;var queriesToRun=searchConfig.queries().slice();if(!queriesToRun.length)
  5411. queriesToRun.push("");progress.setTotalWork(queriesToRun.length);searchNextQuery.call(this);function searchNextQuery()
  5412. {if(!queriesToRun.length){progress.done();callback(result);return;}
  5413. var query=queriesToRun.shift();this._searchInPath(searchConfig.isRegex()?"":query,progress,innerCallback.bind(this));}
  5414. function innerCallback(files)
  5415. {files=files.sort();progress.worked(1);result=result.intersectOrdered(files,String.naturalOrderComparator);searchNextQuery.call(this);}},_searchInPath:function(query,progress,callback)
  5416. {var requestId=this._fileSystemWorkspaceBinding.registerCallback(innerCallback.bind(this));InspectorFrontendHost.searchInPath(requestId,this._fileSystem.path(),query);function innerCallback(files)
  5417. {function trimAndNormalizeFileSystemPath(fullPath)
  5418. {var trimmedPath=fullPath.substr(this._fileSystem.path().length+1);if(WebInspector.isWin())
  5419. trimmedPath=trimmedPath.replace(/\\/g,"/");return trimmedPath;}
  5420. files=files.map(trimAndNormalizeFileSystemPath.bind(this));progress.worked(1);callback(files);}},indexContent:function(progress)
  5421. {progress.setTotalWork(1);var requestId=this._fileSystemWorkspaceBinding.registerProgress(progress);progress.addEventListener(WebInspector.Progress.Events.Canceled,this._indexingCanceled.bind(this,requestId));InspectorFrontendHost.indexPath(requestId,this._fileSystem.path());},_indexingCanceled:function(requestId)
  5422. {InspectorFrontendHost.stopIndexing(requestId);},_extensionForPath:function(path)
  5423. {var extensionIndex=path.lastIndexOf(".");if(extensionIndex===-1)
  5424. return"";return path.substring(extensionIndex+1).toLowerCase();},_contentTypeForExtension:function(extension)
  5425. {if(WebInspector.FileSystemWorkspaceBinding._scriptExtensions[extension])
  5426. return WebInspector.resourceTypes.Script;if(WebInspector.FileSystemWorkspaceBinding._styleSheetExtensions[extension])
  5427. return WebInspector.resourceTypes.Stylesheet;if(WebInspector.FileSystemWorkspaceBinding._documentExtensions[extension])
  5428. return WebInspector.resourceTypes.Document;return WebInspector.resourceTypes.Other;},populate:function()
  5429. {this._fileSystem.requestFilesRecursive("",this._addFile.bind(this));},refresh:function(path,callback)
  5430. {this._fileSystem.requestFilesRecursive(path,this._addFile.bind(this),callback);},excludeFolder:function(path)
  5431. {this._fileSystemWorkspaceBinding._isolatedFileSystemManager.excludedFolderManager().addExcludedFolder(this._fileSystem.path(),path);},createFile:function(path,name,content,callback)
  5432. {this._fileSystem.createFile(path,name,innerCallback.bind(this));var createFilePath;function innerCallback(filePath)
  5433. {if(!filePath){callback(null);return;}
  5434. createFilePath=filePath;if(!content){contentSet.call(this);return;}
  5435. this._fileSystem.setFileContent(filePath,content,contentSet.bind(this));}
  5436. function contentSet()
  5437. {this._addFile(createFilePath);callback(createFilePath);}},deleteFile:function(path)
  5438. {this._fileSystem.deleteFile(path);this._removeFile(path);},remove:function()
  5439. {this._fileSystemWorkspaceBinding._isolatedFileSystemManager.removeFileSystem(this._fileSystem.path());},_addFile:function(filePath)
  5440. {if(!filePath)
  5441. console.assert(false);var slash=filePath.lastIndexOf("/");var parentPath=filePath.substring(0,slash);var name=filePath.substring(slash+1);var url=this._networkMapping.urlForPath(this._fileSystem.path(),filePath);var extension=this._extensionForPath(name);var contentType=this._contentTypeForExtension(extension);var fileDescriptor=new WebInspector.FileDescriptor(parentPath,name,this._fileSystemURL+filePath,url,contentType);this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded,fileDescriptor);},_removeFile:function(path)
  5442. {this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved,path);},dispose:function()
  5443. {this._workspace.removeProject(this._projectId);},__proto__:WebInspector.Object.prototype}
  5444. WebInspector.fileSystemWorkspaceBinding;;WebInspector.OutputStreamDelegate=function()
  5445. {}
  5446. WebInspector.OutputStreamDelegate.prototype={onTransferStarted:function(){},onTransferFinished:function(){},onChunkTransferred:function(reader){},onError:function(reader,event){},}
  5447. WebInspector.OutputStream=function()
  5448. {}
  5449. WebInspector.OutputStream.prototype={write:function(data,callback){},close:function(){}}
  5450. WebInspector.ChunkedReader=function()
  5451. {}
  5452. WebInspector.ChunkedReader.prototype={fileSize:function(){},loadedSize:function(){},fileName:function(){},cancel:function(){}}
  5453. WebInspector.ChunkedFileReader=function(file,chunkSize,delegate)
  5454. {this._file=file;this._fileSize=file.size;this._loadedSize=0;this._chunkSize=chunkSize;this._delegate=delegate;this._isCanceled=false;}
  5455. WebInspector.ChunkedFileReader.prototype={start:function(output)
  5456. {this._output=output;this._reader=new FileReader();this._reader.onload=this._onChunkLoaded.bind(this);this._reader.onerror=this._delegate.onError.bind(this._delegate,this);this._delegate.onTransferStarted();this._loadChunk();},cancel:function()
  5457. {this._isCanceled=true;},loadedSize:function()
  5458. {return this._loadedSize;},fileSize:function()
  5459. {return this._fileSize;},fileName:function()
  5460. {return this._file.name;},_onChunkLoaded:function(event)
  5461. {if(this._isCanceled)
  5462. return;if(event.target.readyState!==FileReader.DONE)
  5463. return;var data=event.target.result;this._loadedSize+=data.length;this._output.write(data);if(this._isCanceled)
  5464. return;this._delegate.onChunkTransferred(this);if(this._loadedSize===this._fileSize){this._file=null;this._reader=null;this._output.close();this._delegate.onTransferFinished();return;}
  5465. this._loadChunk();},_loadChunk:function()
  5466. {var chunkStart=this._loadedSize;var chunkEnd=Math.min(this._fileSize,chunkStart+this._chunkSize);var nextPart=this._file.slice(chunkStart,chunkEnd);this._reader.readAsText(nextPart);}}
  5467. WebInspector.createFileSelectorElement=function(callback){var fileSelectorElement=createElement("input");fileSelectorElement.type="file";fileSelectorElement.style.display="none";fileSelectorElement.setAttribute("tabindex",-1);fileSelectorElement.onchange=onChange;function onChange(event)
  5468. {callback(fileSelectorElement.files[0]);};return fileSelectorElement;}
  5469. WebInspector.FileOutputStream=function()
  5470. {}
  5471. WebInspector.FileOutputStream.prototype={open:function(fileName,callback)
  5472. {this._closed=false;this._writeCallbacks=[];this._fileName=fileName;function callbackWrapper(accepted)
  5473. {if(accepted)
  5474. WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);callback(accepted);}
  5475. WebInspector.fileManager.save(this._fileName,"",true,callbackWrapper.bind(this));},write:function(data,callback)
  5476. {this._writeCallbacks.push(callback);WebInspector.fileManager.append(this._fileName,data);},close:function()
  5477. {this._closed=true;if(this._writeCallbacks.length)
  5478. return;WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);WebInspector.fileManager.close(this._fileName);},_onAppendDone:function(event)
  5479. {if(event.data!==this._fileName)
  5480. return;var callback=this._writeCallbacks.shift();if(callback)
  5481. callback(this);if(!this._writeCallbacks.length){if(this._closed){WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);WebInspector.fileManager.close(this._fileName);}}}};WebInspector.LinkifierFormatter=function()
  5482. {}
  5483. WebInspector.LinkifierFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation){}}
  5484. WebInspector.Linkifier=function(formatter)
  5485. {this._formatter=formatter||new WebInspector.Linkifier.DefaultFormatter(WebInspector.Linkifier.MaxLengthForDisplayedURLs);this._liveLocationsByTarget=new Map();WebInspector.targetManager.observeTargets(this);}
  5486. WebInspector.Linkifier.setLinkHandler=function(handler)
  5487. {WebInspector.Linkifier._linkHandler=handler;}
  5488. WebInspector.Linkifier.handleLink=function(url,lineNumber)
  5489. {if(!WebInspector.Linkifier._linkHandler)
  5490. return false;return WebInspector.Linkifier._linkHandler.handleLink(url,lineNumber);}
  5491. WebInspector.Linkifier.linkifyUsingRevealer=function(revealable,text,fallbackHref,fallbackLineNumber,title,classes)
  5492. {var a=createElement("a");a.className=(classes||"")+" webkit-html-resource-link";a.textContent=text.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayedURLs);a.title=title||text;if(fallbackHref){a.href=fallbackHref;a.lineNumber=fallbackLineNumber;}
  5493. function clickHandler(event)
  5494. {event.stopImmediatePropagation();event.preventDefault();if(fallbackHref&&WebInspector.Linkifier.handleLink(fallbackHref,fallbackLineNumber))
  5495. return;WebInspector.Revealer.reveal(this);}
  5496. a.addEventListener("click",clickHandler.bind(revealable),false);return a;}
  5497. WebInspector.Linkifier.prototype={targetAdded:function(target)
  5498. {this._liveLocationsByTarget.set(target,[]);},targetRemoved:function(target)
  5499. {var liveLocations=this._liveLocationsByTarget.remove(target);for(var i=0;i<liveLocations.length;++i){delete liveLocations[i].anchor.__uiLocation;var anchor=liveLocations[i].anchor;if(anchor.__fallbackAnchor){anchor.href=anchor.__fallbackAnchor.href;anchor.lineNumber=anchor.__fallbackAnchor.lineNumber;anchor.title=anchor.__fallbackAnchor.title;anchor.className=anchor.__fallbackAnchor.className;anchor.textContent=anchor.__fallbackAnchor.textContent;}
  5500. liveLocations[i].location.dispose();}},linkifyScriptLocation:function(target,scriptId,sourceURL,lineNumber,columnNumber,classes)
  5501. {var rawLocation=target&&!target.isDetached()?target.debuggerModel.createRawLocationByScriptId(scriptId,sourceURL,lineNumber,columnNumber||0):null;var fallbackAnchor=WebInspector.linkifyResourceAsNode(sourceURL,lineNumber,classes);if(!rawLocation)
  5502. return fallbackAnchor;var anchor=this._createAnchor(classes);var liveLocation=WebInspector.debuggerWorkspaceBinding.createLiveLocation(rawLocation,this._updateAnchor.bind(this,anchor));this._liveLocationsByTarget.get(rawLocation.target()).push({anchor:anchor,location:liveLocation});anchor.__fallbackAnchor=fallbackAnchor;return anchor;},linkifyRawLocation:function(rawLocation,fallbackUrl,classes)
  5503. {return this.linkifyScriptLocation(rawLocation.target(),rawLocation.scriptId,fallbackUrl,rawLocation.lineNumber,rawLocation.columnNumber,classes);},linkifyConsoleCallFrame:function(target,callFrame,classes)
  5504. {var lineNumber=callFrame.lineNumber?callFrame.lineNumber-1:0;var columnNumber=callFrame.columnNumber?callFrame.columnNumber-1:0;var anchor=this.linkifyScriptLocation(target,callFrame.scriptId,callFrame.url,lineNumber,columnNumber,classes);var script=target&&target.debuggerModel.scriptForId(callFrame.scriptId);var blackboxed=script?WebInspector.BlackboxSupport.isBlackboxed(script.sourceURL,script.isContentScript()):WebInspector.BlackboxSupport.isBlackboxedURL(callFrame.url);if(blackboxed)
  5505. anchor.classList.add("webkit-html-blackbox-link");return anchor;},linkifyCSSLocation:function(rawLocation,classes)
  5506. {var anchor=this._createAnchor(classes);var liveLocation=WebInspector.cssWorkspaceBinding.createLiveLocation(rawLocation,this._updateAnchor.bind(this,anchor));this._liveLocationsByTarget.get(rawLocation.target()).push({anchor:anchor,location:liveLocation});return anchor;},linkifyMedia:function(media)
  5507. {var location=media.rawLocation();if(location)
  5508. return this.linkifyCSSLocation(location);return WebInspector.linkifyResourceAsNode(media.sourceURL,undefined,"subtitle",media.sourceURL);},_createAnchor:function(classes)
  5509. {var anchor=createElement("a");anchor.className=(classes||"")+" webkit-html-resource-link";function clickHandler(event)
  5510. {var uiLocation=anchor.__uiLocation;if(!uiLocation)
  5511. return;event.consume(true);var networkURL=WebInspector.networkMapping.networkURL(uiLocation.uiSourceCode);if(WebInspector.Linkifier.handleLink(networkURL,uiLocation.lineNumber))
  5512. return;WebInspector.Revealer.reveal(uiLocation);}
  5513. anchor.addEventListener("click",clickHandler,false);return anchor;},reset:function()
  5514. {var keys=this._liveLocationsByTarget.keysArray();for(var i=0;i<keys.length;++i){var target=keys[i];this.targetRemoved(target);this.targetAdded(target);}},dispose:function()
  5515. {this.reset();WebInspector.targetManager.unobserveTargets(this);this._liveLocationsByTarget.clear();},_updateAnchor:function(anchor,uiLocation)
  5516. {anchor.__uiLocation=uiLocation;this._formatter.formatLiveAnchor(anchor,uiLocation);}}
  5517. WebInspector.Linkifier.DefaultFormatter=function(maxLength)
  5518. {this._maxLength=maxLength;}
  5519. WebInspector.Linkifier.DefaultFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation)
  5520. {var text=uiLocation.linkText();if(this._maxLength)
  5521. text=text.trimMiddle(this._maxLength);anchor.textContent=text;var titleText=uiLocation.uiSourceCode.originURL();if(typeof uiLocation.lineNumber==="number")
  5522. titleText+=":"+(uiLocation.lineNumber+1);anchor.title=titleText;}}
  5523. WebInspector.Linkifier.DefaultCSSFormatter=function()
  5524. {WebInspector.Linkifier.DefaultFormatter.call(this,WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs);}
  5525. WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs=30;WebInspector.Linkifier.DefaultCSSFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation)
  5526. {WebInspector.Linkifier.DefaultFormatter.prototype.formatLiveAnchor.call(this,anchor,uiLocation);anchor.classList.add("webkit-html-resource-link");anchor.setAttribute("data-uncopyable",anchor.textContent);anchor.textContent="";},__proto__:WebInspector.Linkifier.DefaultFormatter.prototype}
  5527. WebInspector.Linkifier.MaxLengthForDisplayedURLs=150;WebInspector.Linkifier.LinkHandler=function()
  5528. {}
  5529. WebInspector.Linkifier.LinkHandler.prototype={handleLink:function(url,lineNumber){}}
  5530. WebInspector.Linkifier.liveLocationText=function(target,scriptId,lineNumber,columnNumber)
  5531. {var script=target.debuggerModel.scriptForId(scriptId);if(!script)
  5532. return"";var location=(target.debuggerModel.createRawLocation(script,lineNumber,columnNumber||0));var uiLocation=(WebInspector.debuggerWorkspaceBinding.rawLocationToUILocation(location));return uiLocation.linkText();};WebInspector.NetworkMapping=function(workspace,fileSystemMapping)
  5533. {this._workspace=workspace;this._fileSystemMapping=fileSystemMapping;InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.RevealSourceLine,this._revealSourceLine,this);}
  5534. WebInspector.NetworkMapping.prototype={networkURL:function(uiSourceCode)
  5535. {return uiSourceCode.networkURL();},hasMappingForURL:function(url)
  5536. {return this._fileSystemMapping.hasMappingForURL(url);},_networkUISourceCodeForURL:function(url)
  5537. {var splitURL=WebInspector.ParsedURL.splitURLIntoPathComponents(url);var projectId=splitURL[0];var project=this._workspace.project(projectId);return project?project.uiSourceCode(splitURL.slice(1).join("/")):null;},_contentScriptUISourceCodeForURL:function(url)
  5538. {var splitURL=WebInspector.ParsedURL.splitURLIntoPathComponents(url);var projectId="contentscripts:"+splitURL[0];var project=this._workspace.project(projectId);return project?project.uiSourceCode(splitURL.slice(1).join("/")):null;},uiSourceCodeForURL:function(url)
  5539. {var file=this._fileSystemMapping.fileForURL(url);if(!file)
  5540. return this._networkUISourceCodeForURL(url)||this._contentScriptUISourceCodeForURL(url);var projectId=WebInspector.FileSystemWorkspaceBinding.projectId(file.fileSystemPath);var project=this._workspace.project(projectId);return project?project.uiSourceCode(file.filePath):null;},urlForPath:function(fileSystemPath,filePath)
  5541. {return this._fileSystemMapping.urlForPath(fileSystemPath,filePath);},addMapping:function(networkUISourceCode,uiSourceCode,fileSystemWorkspaceBinding)
  5542. {var url=this.networkURL(networkUISourceCode);var path=uiSourceCode.path();var fileSystemPath=fileSystemWorkspaceBinding.fileSystemPath(uiSourceCode.project().id());this._fileSystemMapping.addMappingForResource(url,fileSystemPath,path);},removeMapping:function(uiSourceCode)
  5543. {var networkURL=this.networkURL(uiSourceCode);this._fileSystemMapping.removeMappingForURL(networkURL);},_revealSourceLine:function(event)
  5544. {var url=(event.data["url"]);var lineNumber=(event.data["lineNumber"]);var columnNumber=(event.data["columnNumber"]);var uiSourceCode=this.uiSourceCodeForURL(url);if(uiSourceCode){WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber,columnNumber));return;}
  5545. function listener(event)
  5546. {var uiSourceCode=(event.data);if(this.networkURL(uiSourceCode)===url){WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber,columnNumber));this._workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,listener,this);}}
  5547. this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,listener,this);},}
  5548. WebInspector.networkMapping;;WebInspector.NetworkProjectDelegate=function(workspace,projectId,projectName,projectType)
  5549. {this._name=projectName;this._id=projectId;WebInspector.ContentProviderBasedProjectDelegate.call(this,workspace,projectId,projectType);this._lastUniqueSuffix=0;}
  5550. WebInspector.NetworkProjectDelegate.prototype={id:function()
  5551. {return this._id;},displayName:function()
  5552. {if(typeof this._displayName!=="undefined")
  5553. return this._displayName;if(!this._name){this._displayName=WebInspector.UIString("(no domain)");return this._displayName;}
  5554. var parsedURL=new WebInspector.ParsedURL(this._name);if(parsedURL.isValid){this._displayName=parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"");if(!this._displayName)
  5555. this._displayName=this._name;}
  5556. else
  5557. this._displayName=this._name;return this._displayName;},url:function()
  5558. {return this._name;},addFile:function(parentPath,name,url,contentProvider)
  5559. {return this.addContentProvider(parentPath,name,url,url,contentProvider);},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
  5560. WebInspector.NetworkProject=function(workspace,networkMapping)
  5561. {this._workspace=workspace;this._networkMapping=networkMapping;this._projectDelegates={};this._processedURLs={};WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,this._resourceAdded,this);WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel,WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel,WebInspector.DebuggerModel.Events.FailedToParseScriptSource,this._parsedScriptSource,this);WebInspector.targetManager.addModelListener(WebInspector.CSSStyleModel,WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);WebInspector.targetManager.addModelListener(WebInspector.CSSStyleModel,WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);}
  5562. WebInspector.NetworkProject.prototype={_projectDelegate:function(projectName,isContentScripts)
  5563. {var projectId=(isContentScripts?"contentscripts:":"")+projectName;var projectType=isContentScripts?WebInspector.projectTypes.ContentScripts:WebInspector.projectTypes.Network;if(this._projectDelegates[projectId])
  5564. return this._projectDelegates[projectId];var projectDelegate=new WebInspector.NetworkProjectDelegate(this._workspace,projectId,projectName,projectType);this._projectDelegates[projectId]=projectDelegate;return projectDelegate;},addFileForURL:function(url,contentProvider,isContentScript)
  5565. {var splitURL=WebInspector.ParsedURL.splitURLIntoPathComponents(url);var projectName=splitURL[0];var parentPath=splitURL.slice(1,-1).join("/");var name=splitURL.peekLast()||"";var projectDelegate=this._projectDelegate(projectName,isContentScript||false);var path=projectDelegate.addFile(parentPath,name,url,contentProvider);var uiSourceCode=(this._workspace.uiSourceCode(projectDelegate.id(),path));console.assert(uiSourceCode);return uiSourceCode;},removeFileForURL:function(url)
  5566. {var splitURL=WebInspector.ParsedURL.splitURLIntoPathComponents(url);var projectName=splitURL[0];var path=splitURL.slice(1).join("/");var projectDelegate=this._projectDelegates[projectName];projectDelegate.removeFile(path);},reset:function()
  5567. {for(var projectId in this._projectDelegates)
  5568. this._projectDelegates[projectId].reset();this._projectDelegates={};},_populate:function(target)
  5569. {function populateFrame(frame)
  5570. {for(var i=0;i<frame.childFrames.length;++i)
  5571. populateFrame.call(this,frame.childFrames[i]);var resources=frame.resources();for(var i=0;i<resources.length;++i)
  5572. this._addFile(resources[i].url,new WebInspector.NetworkProject.FallbackResource(resources[i]));}
  5573. var mainFrame=target.resourceTreeModel.mainFrame;if(mainFrame)
  5574. populateFrame.call(this,mainFrame);},_parsedScriptSource:function(event)
  5575. {var script=(event.data);if(!script.sourceURL||(script.isInlineScript()&&!script.hasSourceURL)||script.isSnippet())
  5576. return;if(script.isContentScript()&&!script.hasSourceURL){var parsedURL=new WebInspector.ParsedURL(script.sourceURL);if(!parsedURL.isValid)
  5577. return;}
  5578. this._addFile(script.sourceURL,script,script.isContentScript());},_styleSheetAdded:function(event)
  5579. {var header=(event.data);if(header.isInline&&header.origin!=="inspector")
  5580. return;this._addFile(header.resourceURL(),header,false);},_styleSheetRemoved:function(event)
  5581. {var header=(event.data);if(header.isInline&&header.origin!=="inspector")
  5582. return;this._removeFile(header.resourceURL());},_resourceAdded:function(event)
  5583. {var resource=(event.data);this._addFile(resource.url,new WebInspector.NetworkProject.FallbackResource(resource));},_mainFrameNavigated:function(event)
  5584. {var resourceTreeModel=(event.target);this._reset(resourceTreeModel.target());},_addFile:function(url,contentProvider,isContentScript)
  5585. {if(this._networkMapping.hasMappingForURL(url))
  5586. return;var type=contentProvider.contentType();if(type!==WebInspector.resourceTypes.Stylesheet&&type!==WebInspector.resourceTypes.Document&&type!==WebInspector.resourceTypes.Script)
  5587. return;if(this._processedURLs[url])
  5588. return;this._processedURLs[url]=true;this.addFileForURL(url,contentProvider,isContentScript);},_removeFile:function(url)
  5589. {if(!this._processedURLs[url])
  5590. return;this._processedURLs[url]=false;this.removeFileForURL(url);},_reset:function(target)
  5591. {this._processedURLs={};this.reset();this._populate(target);},__proto__:WebInspector.Object.prototype}
  5592. WebInspector.NetworkProject.FallbackResource=function(resource)
  5593. {this._resource=resource;}
  5594. WebInspector.NetworkProject.FallbackResource.prototype={contentURL:function()
  5595. {return this._resource.contentURL();},contentType:function()
  5596. {return this._resource.resourceType();},requestContent:function(callback)
  5597. {function loadFallbackContent()
  5598. {var scripts=this._resource.target().debuggerModel.scriptsForSourceURL(this._resource.url);if(!scripts.length){callback(null);return;}
  5599. var contentProvider;var type=this._resource.resourceType();if(type===WebInspector.resourceTypes.Document)
  5600. contentProvider=new WebInspector.ConcatenatedScriptsContentProvider(scripts);else if(type===WebInspector.resourceTypes.Script)
  5601. contentProvider=scripts[0];console.assert(contentProvider,"Resource content request failed. "+this._resource.url);contentProvider.requestContent(callback);}
  5602. function requestContentLoaded(content)
  5603. {if(content)
  5604. callback(content)
  5605. else
  5606. loadFallbackContent.call(this);}
  5607. this._resource.requestContent(requestContentLoaded.bind(this));},searchInContent:function(query,caseSensitive,isRegex,callback)
  5608. {function documentContentLoaded(content)
  5609. {if(content===null){callback([]);return;}
  5610. var result=WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex);callback(result);}
  5611. if(this.contentType()===WebInspector.resourceTypes.Document){this.requestContent(documentContentLoaded);return;}
  5612. this._resource.searchInContent(query,caseSensitive,isRegex,callback);}}
  5613. WebInspector.networkProject;;WebInspector.PresentationConsoleMessageHelper=function(workspace)
  5614. {this._workspace=workspace;this._pendingConsoleMessages={};this._presentationConsoleMessages=[];this._uiSourceCodeToMessages=new Map();this._uiSourceCodeToEventTarget=new Map();workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved,this);WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._onConsoleMessageAdded,this);WebInspector.multitargetConsoleModel.messages().forEach(this._consoleMessageAdded,this);WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel,WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel,WebInspector.DebuggerModel.Events.FailedToParseScriptSource,this._parsedScriptSource,this);WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel,WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
  5615. WebInspector.PresentationConsoleMessageHelper.Events={ConsoleMessageAdded:"ConsoleMessageAdded",ConsoleMessageRemoved:"ConsoleMessageRemoved",ConsoleMessagesCleared:"ConsoleMessagesCleared",}
  5616. WebInspector.PresentationConsoleMessageHelper.prototype={addConsoleMessageEventListener:function(eventType,uiSourceCode,listener,thisObject)
  5617. {var target=this._uiSourceCodeToEventTarget.get(uiSourceCode);if(!target){target=new WebInspector.Object();this._uiSourceCodeToEventTarget.set(uiSourceCode,target);}
  5618. target.addEventListener(eventType,listener,thisObject);},removeConsoleMessageEventListener:function(eventType,uiSourceCode,listener,thisObject)
  5619. {var target=this._uiSourceCodeToEventTarget.get(uiSourceCode);if(!target)
  5620. return;target.removeEventListener(eventType,listener,thisObject);},consoleMessages:function(uiSourceCode)
  5621. {return this._uiSourceCodeToMessages.get(uiSourceCode)||[];},_dispatchConsoleEvent:function(eventType,uiSourceCode,message)
  5622. {var target=this._uiSourceCodeToEventTarget.get(uiSourceCode);if(!target)
  5623. return;target.dispatchEventToListeners(eventType,message);},_uiSourceCodeRemoved:function(event)
  5624. {var uiSourceCode=(event.data);this._uiSourceCodeToEventTarget.remove(uiSourceCode);this._uiSourceCodeToMessages.remove(uiSourceCode);},_projectRemoved:function(event)
  5625. {var project=(event.data);var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i){this._uiSourceCodeToEventTarget.remove(uiSourceCodes[i]);this._uiSourceCodeToMessages.remove(uiSourceCodes[i]);}},_onConsoleMessageAdded:function(event)
  5626. {var message=(event.data);this._consoleMessageAdded(message);},_consoleMessageAdded:function(message)
  5627. {if(!message.url||!message.isErrorOrWarning())
  5628. return;var rawLocation=this._rawLocation(message);if(rawLocation)
  5629. this._addConsoleMessageToScript(message,rawLocation);else
  5630. this._addPendingConsoleMessage(message);},_rawLocation:function(message)
  5631. {var lineNumber=message.stackTrace?message.stackTrace[0].lineNumber-1:message.line-1;var columnNumber=message.stackTrace&&message.stackTrace[0].columnNumber?message.stackTrace[0].columnNumber-1:0;if(message.scriptId)
  5632. return message.target().debuggerModel.createRawLocationByScriptId(message.scriptId,message.url||"",lineNumber,columnNumber);return message.target().debuggerModel.createRawLocationByURL(message.url||"",lineNumber,columnNumber);},_addConsoleMessageToScript:function(message,rawLocation)
  5633. {this._presentationConsoleMessages.push(new WebInspector.PresentationConsoleMessage(message,rawLocation));},_addPendingConsoleMessage:function(message)
  5634. {if(!message.url)
  5635. return;if(!this._pendingConsoleMessages[message.url])
  5636. this._pendingConsoleMessages[message.url]=[];this._pendingConsoleMessages[message.url].push(message);},_parsedScriptSource:function(event)
  5637. {var script=(event.data);var messages=this._pendingConsoleMessages[script.sourceURL];if(!messages)
  5638. return;var pendingMessages=[];for(var i=0;i<messages.length;i++){var message=messages[i];var rawLocation=this._rawLocation(message);if(script.target()===message.target()&&script.scriptId===rawLocation.scriptId)
  5639. this._addConsoleMessageToScript(message,rawLocation);else
  5640. pendingMessages.push(message);}
  5641. if(pendingMessages.length)
  5642. this._pendingConsoleMessages[script.sourceURL]=pendingMessages;else
  5643. delete this._pendingConsoleMessages[script.sourceURL];},_presentationConsoleMessageAdded:function(message)
  5644. {var uiSourceCode=message._uiLocation.uiSourceCode;var messages=this._uiSourceCodeToMessages.get(uiSourceCode);if(!messages){messages=[];this._uiSourceCodeToMessages.set(uiSourceCode,messages);}
  5645. messages.push(message);this._dispatchConsoleEvent(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessageAdded,uiSourceCode,message);},_presentationConsoleMessageRemoved:function(message)
  5646. {var uiSourceCode=message._uiLocation.uiSourceCode;var messages=this._uiSourceCodeToMessages.get(uiSourceCode);if(!messages)
  5647. return;messages.remove(message);this._dispatchConsoleEvent(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessageRemoved,uiSourceCode,message);},_consoleCleared:function()
  5648. {this._pendingConsoleMessages={};for(var i=0;i<this._presentationConsoleMessages.length;++i)
  5649. this._presentationConsoleMessages[i].dispose();this._presentationConsoleMessages=[];var targets=this._uiSourceCodeToEventTarget.valuesArray();for(var i=0;i<targets.length;++i)
  5650. targets[i].dispatchEventToListeners(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessagesCleared);this._uiSourceCodeToMessages.clear();},_debuggerReset:function()
  5651. {this._consoleCleared();}}
  5652. WebInspector.PresentationConsoleMessage=function(message,rawLocation)
  5653. {this.originalMessage=message;this._liveLocation=WebInspector.debuggerWorkspaceBinding.createLiveLocation(rawLocation,this._updateLocation.bind(this));}
  5654. WebInspector.PresentationConsoleMessage.prototype={_updateLocation:function(uiLocation)
  5655. {if(this._uiLocation)
  5656. WebInspector.presentationConsoleMessageHelper._presentationConsoleMessageRemoved(this);this._uiLocation=uiLocation;WebInspector.presentationConsoleMessageHelper._presentationConsoleMessageAdded(this);},get lineNumber()
  5657. {return this._uiLocation.lineNumber;},dispose:function()
  5658. {this._liveLocation.dispose();}}
  5659. WebInspector.presentationConsoleMessageHelper;;WebInspector.resourceForURL=function(url)
  5660. {var targets=WebInspector.targetManager.targets();for(var i=0;i<targets.length;++i){var resource=targets[i].resourceTreeModel.resourceForURL(url);if(resource)
  5661. return resource;}
  5662. return null;}
  5663. WebInspector.forAllResources=function(callback)
  5664. {var targets=WebInspector.targetManager.targets();for(var i=0;i<targets.length;++i)
  5665. targets[i].resourceTreeModel.forAllResources(callback);}
  5666. WebInspector.displayNameForURL=function(url)
  5667. {if(!url)
  5668. return"";var resource=WebInspector.resourceForURL(url);if(resource)
  5669. return resource.displayName;var uiSourceCode=WebInspector.networkMapping.uiSourceCodeForURL(url);if(uiSourceCode)
  5670. return uiSourceCode.displayName();if(!WebInspector.targetManager.inspectedPageURL())
  5671. return url.trimURL("");var parsedURL=WebInspector.targetManager.inspectedPageURL().asParsedURL();var lastPathComponent=parsedURL?parsedURL.lastPathComponent:parsedURL;var index=WebInspector.targetManager.inspectedPageURL().indexOf(lastPathComponent);if(index!==-1&&index+lastPathComponent.length===WebInspector.targetManager.inspectedPageURL().length){var baseURL=WebInspector.targetManager.inspectedPageURL().substring(0,index);if(url.startsWith(baseURL))
  5672. return url.substring(index);}
  5673. if(!parsedURL)
  5674. return url;var displayName=url.trimURL(parsedURL.host);return displayName==="/"?parsedURL.host+"/":displayName;}
  5675. WebInspector.linkifyStringAsFragmentWithCustomLinkifier=function(string,linkifier)
  5676. {var container=createDocumentFragment();var linkStringRegEx=/(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/;while(string){var linkString=linkStringRegEx.exec(string);if(!linkString)
  5677. break;linkString=linkString[0];var linkIndex=string.indexOf(linkString);var nonLink=string.substring(0,linkIndex);container.appendChild(createTextNode(nonLink));var title=linkString;var realURL=(linkString.startsWith("www.")?"http://"+linkString:linkString);var parsedURL=new WebInspector.ParsedURL(realURL);var splitResult=WebInspector.ParsedURL.splitLineAndColumn(parsedURL.lastPathComponent);var linkNode;if(splitResult){var link=realURL.substring(0,realURL.length-parsedURL.lastPathComponent.length+splitResult.url.length);linkNode=linkifier(title,link,splitResult.lineNumber,splitResult.columnNumber);}else
  5678. linkNode=linkifier(title,realURL);container.appendChild(linkNode);string=string.substring(linkIndex+linkString.length,string.length);}
  5679. if(string)
  5680. container.appendChild(createTextNode(string));return container;}
  5681. WebInspector.linkifyStringAsFragment=function(string)
  5682. {function linkifier(title,url,lineNumber,columnNumber)
  5683. {var isExternal=!WebInspector.resourceForURL(url)&&!WebInspector.networkMapping.uiSourceCodeForURL(url);var urlNode=WebInspector.linkifyURLAsNode(url,title,undefined,isExternal);if(typeof lineNumber!=="undefined"){urlNode.lineNumber=lineNumber;if(typeof columnNumber!=="undefined")
  5684. urlNode.columnNumber=columnNumber;}
  5685. return urlNode;}
  5686. return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string,linkifier);}
  5687. WebInspector.linkifyURLAsNode=function(url,linkText,classes,isExternal,tooltipText)
  5688. {if(!linkText)
  5689. linkText=url;classes=(classes?classes+" ":"");classes+=isExternal?"webkit-html-external-link":"webkit-html-resource-link";var a=createElement("a");var href=sanitizeHref(url);if(href!==null)
  5690. a.href=href;a.className=classes;if(typeof tooltipText==="undefined")
  5691. a.title=url;else if(typeof tooltipText!=="string"||tooltipText.length)
  5692. a.title=tooltipText;a.textContent=linkText.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayedURLs);if(isExternal)
  5693. a.setAttribute("target","_blank");return a;}
  5694. WebInspector.formatLinkText=function(url,lineNumber)
  5695. {var text=url?WebInspector.displayNameForURL(url):WebInspector.UIString("(program)");if(typeof lineNumber==="number")
  5696. text+=":"+(lineNumber+1);return text;}
  5697. WebInspector.linkifyResourceAsNode=function(url,lineNumber,classes,tooltipText)
  5698. {var linkText=WebInspector.formatLinkText(url,lineNumber);var anchor=WebInspector.linkifyURLAsNode(url,linkText,classes,false,tooltipText);anchor.lineNumber=lineNumber;return anchor;}
  5699. WebInspector.linkifyRequestAsNode=function(request)
  5700. {var anchor=WebInspector.linkifyURLAsNode(request.url);anchor.requestId=request.requestId;return anchor;};WebInspector.ScriptSnippetModel=function(workspace)
  5701. {this._workspace=workspace;this._uiSourceCodeForSnippetId={};this._snippetIdForUISourceCode=new Map();this._mappingForTarget=new Map();this._snippetStorage=new WebInspector.SnippetStorage("script","Script snippet #");this._lastSnippetEvaluationIndexSetting=WebInspector.settings.createSetting("lastSnippetEvaluationIndex",0);this._projectId=WebInspector.projectTypes.Snippets+":";this._projectDelegate=new WebInspector.SnippetsProjectDelegate(workspace,this,this._projectId);this._project=this._workspace.project(this._projectId);this._loadSnippets();WebInspector.targetManager.observeTargets(this);}
  5702. WebInspector.ScriptSnippetModel.prototype={targetAdded:function(target)
  5703. {this._mappingForTarget.set(target,new WebInspector.SnippetScriptMapping(target,this));},targetRemoved:function(target)
  5704. {this._mappingForTarget.remove(target);},snippetScriptMapping:function(target){return this._mappingForTarget.get(target);},addScript:function(script)
  5705. {this._mappingForTarget.get(script.target()).addScript(script);},createSnippetScriptMapping:function(target)
  5706. {return new WebInspector.SnippetScriptMapping(target,this);},project:function()
  5707. {return this._project;},_loadSnippets:function()
  5708. {var snippets=this._snippetStorage.snippets();for(var i=0;i<snippets.length;++i)
  5709. this._addScriptSnippet(snippets[i]);},createScriptSnippet:function(content)
  5710. {var snippet=this._snippetStorage.createSnippet();snippet.content=content;return this._addScriptSnippet(snippet);},_addScriptSnippet:function(snippet)
  5711. {var path=this._projectDelegate.addSnippet(snippet.name,new WebInspector.SnippetContentProvider(snippet));var uiSourceCode=this._workspace.uiSourceCode(this._projectId,path);if(!uiSourceCode){console.assert(uiSourceCode);return"";}
  5712. uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._snippetIdForUISourceCode.set(uiSourceCode,snippet.id);var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);this._uiSourceCodeForSnippetId[snippet.id]=uiSourceCode;return path;},_workingCopyChanged:function(event)
  5713. {var uiSourceCode=(event.target);this._scriptSnippetEdited(uiSourceCode);},deleteScriptSnippet:function(path)
  5714. {var uiSourceCode=this._workspace.uiSourceCode(this._projectId,path);if(!uiSourceCode)
  5715. return;var snippetId=this._snippetIdForUISourceCode.get(uiSourceCode)||"";var snippet=this._snippetStorage.snippetForId(snippetId);this._snippetStorage.deleteSnippet(snippet);this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);delete this._uiSourceCodeForSnippetId[snippet.id];this._snippetIdForUISourceCode.remove(uiSourceCode);this._projectDelegate.removeFile(snippet.name);},renameScriptSnippet:function(name,newName,callback)
  5716. {newName=newName.trim();if(!newName||newName.indexOf("/")!==-1||name===newName||this._snippetStorage.snippetForName(newName)){callback(false);return;}
  5717. var snippet=this._snippetStorage.snippetForName(name);console.assert(snippet,"Snippet '"+name+"' was not found.");var uiSourceCode=this._uiSourceCodeForSnippetId[snippet.id];console.assert(uiSourceCode,"No uiSourceCode was found for snippet '"+name+"'.");var breakpointLocations=this._removeBreakpoints(uiSourceCode);snippet.name=newName;this._restoreBreakpoints(uiSourceCode,breakpointLocations);callback(true,newName);},_setScriptSnippetContent:function(name,newContent)
  5718. {var snippet=this._snippetStorage.snippetForName(name);snippet.content=newContent;},_scriptSnippetEdited:function(uiSourceCode)
  5719. {var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);this._mappingForTarget.valuesArray().forEach(function(mapping){mapping._restoreBreakpoints(uiSourceCode,breakpointLocations);});},_nextEvaluationIndex:function()
  5720. {var evaluationIndex=this._lastSnippetEvaluationIndexSetting.get()+1;this._lastSnippetEvaluationIndexSetting.set(evaluationIndex);return evaluationIndex;},evaluateScriptSnippet:function(executionContext,uiSourceCode)
  5721. {var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);var target=executionContext.target();var evaluationIndex=this._nextEvaluationIndex();var mapping=this._mappingForTarget.get(target);mapping._setEvaluationIndex(evaluationIndex,uiSourceCode);var evaluationUrl=mapping._evaluationSourceURL(uiSourceCode);var expression=uiSourceCode.workingCopy();WebInspector.console.show();target.debuggerAgent().compileScript(expression,evaluationUrl,executionContext.id,compileCallback.bind(this,target));function compileCallback(target,error,scriptId,exceptionDetails)
  5722. {if(!uiSourceCode||this._mappingForTarget.get(target).evaluationIndex(uiSourceCode)!==evaluationIndex)
  5723. return;if(error){console.error(error);return;}
  5724. if(!scriptId){this._printRunOrCompileScriptResultFailure(target,exceptionDetails,evaluationUrl);return;}
  5725. var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);this._runScript(scriptId,executionContext,evaluationUrl);}},_runScript:function(scriptId,executionContext,sourceURL)
  5726. {var target=executionContext.target();target.debuggerAgent().runScript(scriptId,executionContext.id,"console",false,runCallback.bind(this,target));function runCallback(target,error,result,exceptionDetails)
  5727. {if(error){console.error(error);return;}
  5728. if(!exceptionDetails)
  5729. this._printRunScriptResult(target,result,sourceURL);else
  5730. this._printRunOrCompileScriptResultFailure(target,exceptionDetails,sourceURL);}},_printRunScriptResult:function(target,result,sourceURL)
  5731. {var consoleMessage=new WebInspector.ConsoleMessage(target,WebInspector.ConsoleMessage.MessageSource.JS,WebInspector.ConsoleMessage.MessageLevel.Log,"",undefined,sourceURL,undefined,undefined,undefined,[result],undefined);target.consoleModel.addMessage(consoleMessage);},_printRunOrCompileScriptResultFailure:function(target,exceptionDetails,sourceURL)
  5732. {var consoleMessage=new WebInspector.ConsoleMessage(target,exceptionDetails.source,WebInspector.ConsoleMessage.MessageLevel.Error,exceptionDetails.text,undefined,sourceURL,exceptionDetails.line,exceptionDetails.column,undefined,undefined,exceptionDetails.stackTrace);target.consoleModel.addMessage(consoleMessage);},_removeBreakpoints:function(uiSourceCode)
  5733. {var breakpointLocations=WebInspector.breakpointManager.breakpointLocationsForUISourceCode(uiSourceCode);for(var i=0;i<breakpointLocations.length;++i)
  5734. breakpointLocations[i].breakpoint.remove();return breakpointLocations;},_restoreBreakpoints:function(uiSourceCode,breakpointLocations)
  5735. {for(var i=0;i<breakpointLocations.length;++i){var uiLocation=breakpointLocations[i].uiLocation;var breakpoint=breakpointLocations[i].breakpoint;WebInspector.breakpointManager.setBreakpoint(uiSourceCode,uiLocation.lineNumber,uiLocation.columnNumber,breakpoint.condition(),breakpoint.enabled());}},_releaseSnippetScript:function(uiSourceCode)
  5736. {this._mappingForTarget.valuesArray().forEach(function(mapping){mapping._releaseSnippetScript(uiSourceCode);});},_snippetIdForSourceURL:function(sourceURL)
  5737. {var snippetPrefix=WebInspector.Script.snippetSourceURLPrefix;if(!sourceURL.startsWith(snippetPrefix))
  5738. return null;var splitURL=sourceURL.substring(snippetPrefix.length).split("_");var snippetId=splitURL[0];return snippetId;},__proto__:WebInspector.Object.prototype}
  5739. WebInspector.SnippetScriptMapping=function(target,scriptSnippetModel)
  5740. {this._target=target;this._scriptSnippetModel=scriptSnippetModel;this._uiSourceCodeForScriptId={};this._scriptForUISourceCode=new Map();this._evaluationIndexForUISourceCode=new Map();target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._reset,this);}
  5741. WebInspector.SnippetScriptMapping.prototype={_releaseSnippetScript:function(uiSourceCode)
  5742. {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
  5743. return;delete this._uiSourceCodeForScriptId[script.scriptId];this._scriptForUISourceCode.remove(uiSourceCode);this._evaluationIndexForUISourceCode.remove(uiSourceCode);},_setEvaluationIndex:function(evaluationIndex,uiSourceCode)
  5744. {this._evaluationIndexForUISourceCode.set(uiSourceCode,evaluationIndex);},evaluationIndex:function(uiSourceCode)
  5745. {return this._evaluationIndexForUISourceCode.get(uiSourceCode);},_evaluationSourceURL:function(uiSourceCode)
  5746. {var evaluationSuffix="_"+this._evaluationIndexForUISourceCode.get(uiSourceCode);var snippetId=this._scriptSnippetModel._snippetIdForUISourceCode.get(uiSourceCode);return WebInspector.Script.snippetSourceURLPrefix+snippetId+evaluationSuffix;},_reset:function()
  5747. {this._uiSourceCodeForScriptId={};this._scriptForUISourceCode.clear();this._evaluationIndexForUISourceCode.clear();},rawLocationToUILocation:function(rawLocation)
  5748. {var debuggerModelLocation=(rawLocation);var uiSourceCode=this._uiSourceCodeForScriptId[debuggerModelLocation.scriptId];if(!uiSourceCode)
  5749. return null;return uiSourceCode.uiLocation(debuggerModelLocation.lineNumber,debuggerModelLocation.columnNumber||0);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
  5750. {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
  5751. return null;return this._target.debuggerModel.createRawLocation(script,lineNumber,columnNumber);},snippetIdForSourceURL:function(sourceURL)
  5752. {return this._scriptSnippetModel._snippetIdForSourceURL(sourceURL);},addScript:function(script)
  5753. {var snippetId=this.snippetIdForSourceURL(script.sourceURL);if(!snippetId)
  5754. return;var uiSourceCode=this._scriptSnippetModel._uiSourceCodeForSnippetId[snippetId];if(!uiSourceCode||this._evaluationSourceURL(uiSourceCode)!==script.sourceURL)
  5755. return;console.assert(!this._scriptForUISourceCode.get(uiSourceCode));WebInspector.debuggerWorkspaceBinding.setSourceMapping(this._target,uiSourceCode,this);this._uiSourceCodeForScriptId[script.scriptId]=uiSourceCode;this._scriptForUISourceCode.set(uiSourceCode,script);WebInspector.debuggerWorkspaceBinding.pushSourceMapping(script,this);},_restoreBreakpoints:function(uiSourceCode,breakpointLocations)
  5756. {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
  5757. return;var rawLocation=(script.target().debuggerModel.createRawLocation(script,0,0));var scriptUISourceCode=WebInspector.debuggerWorkspaceBinding.rawLocationToUILocation(rawLocation).uiSourceCode;if(scriptUISourceCode)
  5758. this._scriptSnippetModel._restoreBreakpoints(scriptUISourceCode,breakpointLocations);},isIdentity:function()
  5759. {return false;},uiLineHasMapping:function(uiSourceCode,lineNumber)
  5760. {return true;}}
  5761. WebInspector.SnippetContentProvider=function(snippet)
  5762. {this._snippet=snippet;}
  5763. WebInspector.SnippetContentProvider.prototype={contentURL:function()
  5764. {return"";},contentType:function()
  5765. {return WebInspector.resourceTypes.Script;},requestContent:function(callback)
  5766. {callback(this._snippet.content);},searchInContent:function(query,caseSensitive,isRegex,callback)
  5767. {function performSearch()
  5768. {callback(WebInspector.ContentProvider.performSearchInContent(this._snippet.content,query,caseSensitive,isRegex));}
  5769. window.setTimeout(performSearch.bind(this),0);}}
  5770. WebInspector.SnippetsProjectDelegate=function(workspace,model,id)
  5771. {WebInspector.ContentProviderBasedProjectDelegate.call(this,workspace,id,WebInspector.projectTypes.Snippets);this._model=model;}
  5772. WebInspector.SnippetsProjectDelegate.prototype={addSnippet:function(name,contentProvider)
  5773. {return this.addContentProvider("",name,name,name,contentProvider);},canSetFileContent:function()
  5774. {return true;},setFileContent:function(path,newContent,callback)
  5775. {this._model._setScriptSnippetContent(path,newContent);callback("");},canRename:function()
  5776. {return true;},performRename:function(path,newName,callback)
  5777. {this._model.renameScriptSnippet(path,newName,callback);},createFile:function(path,name,content,callback)
  5778. {var filePath=this._model.createScriptSnippet(content);callback(filePath);},deleteFile:function(path)
  5779. {this._model.deleteScriptSnippet(path);},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
  5780. WebInspector.scriptSnippetModel;;window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem;WebInspector.TempFile=function()
  5781. {this._fileEntry=null;this._writer=null;}
  5782. WebInspector.TempFile.create=function(dirPath,name)
  5783. {var file=new WebInspector.TempFile();function requestTempFileSystem()
  5784. {return new Promise(window.requestFileSystem.bind(window,window.TEMPORARY,10));}
  5785. function getDirectoryEntry(fs)
  5786. {return new Promise(fs.root.getDirectory.bind(fs.root,dirPath,{create:true}));}
  5787. function getFileEntry(dir)
  5788. {return new Promise(dir.getFile.bind(dir,name,{create:true}));}
  5789. function createFileWriter(fileEntry)
  5790. {file._fileEntry=fileEntry;return new Promise(fileEntry.createWriter.bind(fileEntry));}
  5791. function truncateFile(writer)
  5792. {if(!writer.length){file._writer=writer;return Promise.resolve(file);}
  5793. function truncate(fulfill,reject)
  5794. {writer.onwriteend=fulfill;writer.onerror=reject;writer.truncate(0);}
  5795. function didTruncate()
  5796. {file._writer=writer;writer.onwriteend=null;writer.onerror=null;return Promise.resolve(file);}
  5797. function onTruncateError(e)
  5798. {writer.onwriteend=null;writer.onerror=null;throw e;}
  5799. return new Promise(truncate).then(didTruncate,onTruncateError);}
  5800. return WebInspector.TempFile.ensureTempStorageCleared().then(requestTempFileSystem).then(getDirectoryEntry).then(getFileEntry).then(createFileWriter).then(truncateFile);}
  5801. WebInspector.TempFile.prototype={write:function(strings,callback)
  5802. {var blob=new Blob(strings,{type:'text/plain'});this._writer.onerror=function(e)
  5803. {WebInspector.console.error("Failed to write into a temp file: "+e.target.error.message);callback(-1);}
  5804. this._writer.onwriteend=function(e)
  5805. {callback(e.target.length);}
  5806. this._writer.write(blob);},finishWriting:function()
  5807. {this._writer=null;},read:function(callback)
  5808. {this.readRange(undefined,undefined,callback);},readRange:function(startOffset,endOffset,callback)
  5809. {function didGetFile(file)
  5810. {var reader=new FileReader();if(typeof startOffset==="number"||typeof endOffset==="number")
  5811. file=file.slice((startOffset),(endOffset));reader.onloadend=function(e)
  5812. {callback((this.result));};reader.onerror=function(error)
  5813. {WebInspector.console.error("Failed to read from temp file: "+error.message);};reader.readAsText(file);}
  5814. function didFailToGetFile(error)
  5815. {WebInspector.console.error("Failed to load temp file: "+error.message);callback(null);}
  5816. this._fileEntry.file(didGetFile,didFailToGetFile);},writeToOutputSteam:function(outputStream,delegate)
  5817. {function didGetFile(file)
  5818. {var reader=new WebInspector.ChunkedFileReader(file,10*1000*1000,delegate);reader.start(outputStream);}
  5819. function didFailToGetFile(error)
  5820. {WebInspector.console.error("Failed to load temp file: "+error.message);outputStream.close();}
  5821. this._fileEntry.file(didGetFile,didFailToGetFile);},remove:function()
  5822. {if(this._fileEntry)
  5823. this._fileEntry.remove(function(){});}}
  5824. WebInspector.DeferredTempFile=function(dirPath,name)
  5825. {this._chunks=[];this._tempFile=null;this._isWriting=false;this._finishCallback=null;this._finishedWriting=false;this._callsPendingOpen=[];this._pendingReads=[];WebInspector.TempFile.create(dirPath,name).then(this._didCreateTempFile.bind(this),this._failedToCreateTempFile.bind(this));}
  5826. WebInspector.DeferredTempFile.prototype={write:function(strings,callback)
  5827. {if(!this._chunks)
  5828. return;if(this._finishCallback)
  5829. throw new Error("No writes are allowed after close.");this._chunks.push({strings:strings,callback:callback});if(this._tempFile&&!this._isWriting)
  5830. this._writeNextChunk();},finishWriting:function(callback)
  5831. {this._finishCallback=callback;if(this._finishedWriting)
  5832. callback(this._tempFile);else if(!this._isWriting&&!this._chunks.length)
  5833. this._notifyFinished();},_failedToCreateTempFile:function(e)
  5834. {WebInspector.console.error("Failed to create temp file "+e.code+" : "+e.message);this._notifyFinished();},_didCreateTempFile:function(tempFile)
  5835. {this._tempFile=tempFile;var callsPendingOpen=this._callsPendingOpen;this._callsPendingOpen=null;for(var i=0;i<callsPendingOpen.length;++i)
  5836. callsPendingOpen[i]();if(this._chunks.length)
  5837. this._writeNextChunk();},_writeNextChunk:function()
  5838. {var chunk=this._chunks.shift();this._isWriting=true;this._tempFile.write((chunk.strings),this._didWriteChunk.bind(this,chunk.callback));},_didWriteChunk:function(callback,size)
  5839. {this._isWriting=false;if(size===-1){this._tempFile=null;this._notifyFinished();return;}
  5840. if(callback)
  5841. callback(size);if(this._chunks.length)
  5842. this._writeNextChunk();else if(this._finishCallback)
  5843. this._notifyFinished();},_notifyFinished:function()
  5844. {this._finishedWriting=true;if(this._tempFile)
  5845. this._tempFile.finishWriting();var chunks=this._chunks;this._chunks=[];for(var i=0;i<chunks.length;++i){if(chunks[i].callback)
  5846. chunks[i].callback(-1);}
  5847. if(this._finishCallback)
  5848. this._finishCallback(this._tempFile);var pendingReads=this._pendingReads;this._pendingReads=[];for(var i=0;i<pendingReads.length;++i)
  5849. pendingReads[i]();},readRange:function(startOffset,endOffset,callback)
  5850. {if(!this._finishedWriting){this._pendingReads.push(this.readRange.bind(this,startOffset,endOffset,callback));return;}
  5851. if(!this._tempFile){callback(null);return;}
  5852. this._tempFile.readRange(startOffset,endOffset,callback);},writeToOutputStream:function(outputStream,delegate)
  5853. {if(this._callsPendingOpen){this._callsPendingOpen.push(this.writeToOutputStream.bind(this,outputStream,delegate));return;}
  5854. if(this._tempFile)
  5855. this._tempFile.writeToOutputSteam(outputStream,delegate);},remove:function()
  5856. {if(this._callsPendingOpen){this._callsPendingOpen.push(this.remove.bind(this));return;}
  5857. if(this._tempFile)
  5858. this._tempFile.remove();}}
  5859. WebInspector.TempFile._clearTempStorage=function(fulfill,reject)
  5860. {function handleError(event)
  5861. {WebInspector.console.error(WebInspector.UIString("Failed to clear temp storage: %s",event.data));reject(event.data);}
  5862. function handleMessage(event)
  5863. {if(event.data.type==="tempStorageCleared"){if(event.data.error)
  5864. WebInspector.console.error(event.data.error);else
  5865. fulfill(undefined);return;}
  5866. reject(event.data);}
  5867. try{var worker=new WorkerRuntime.Worker("temp_storage_shared_worker","TempStorageCleaner");worker.onerror=handleError;worker.port.onmessage=handleMessage;worker.port.onerror=handleError;}catch(e){if(e.name==="URLMismatchError")
  5868. console.log("Shared worker wasn't started due to url difference. "+e);else
  5869. throw e;}}
  5870. WebInspector.TempFile.ensureTempStorageCleared=function()
  5871. {if(!WebInspector.TempFile._storageCleanerPromise)
  5872. WebInspector.TempFile._storageCleanerPromise=new Promise(WebInspector.TempFile._clearTempStorage);return WebInspector.TempFile._storageCleanerPromise;};WebInspector.WorkspaceController=function(workspace)
  5873. {this._workspace=workspace;window.addEventListener("focus",this._windowFocused.bind(this),false);this._fileSystemRefreshThrottler=new WebInspector.Throttler(1000);}
  5874. WebInspector.WorkspaceController.prototype={_windowFocused:function(event)
  5875. {this._fileSystemRefreshThrottler.schedule(refreshFileSystems.bind(this));function refreshFileSystems(callback)
  5876. {var barrier=new CallbackBarrier();var projects=this._workspace.projects();for(var i=0;i<projects.length;++i)
  5877. projects[i].refresh("/",barrier.createCallback());barrier.callWhenDone(callback);}}};WebInspector.ContentScriptProjectDecorator=function()
  5878. {WebInspector.targetManager.addModelListener(WebInspector.RuntimeModel,WebInspector.RuntimeModel.Events.ExecutionContextCreated,this._onContextCreated,this);WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.ProjectAdded,this._onProjectAdded,this);}
  5879. WebInspector.ContentScriptProjectDecorator._updateProjectWithExtensionName=function(project,context)
  5880. {if(project.url().startsWith(context.origin))
  5881. project.setDisplayName(context.name);}
  5882. WebInspector.ContentScriptProjectDecorator.prototype={_onContextCreated:function(event)
  5883. {var context=(event.data);if(!context.origin||!context.name)
  5884. return;var projects=WebInspector.workspace.projects();projects=projects.filter(contentProjectWithName);for(var i=0;i<projects.length;++i)
  5885. WebInspector.ContentScriptProjectDecorator._updateProjectWithExtensionName(projects[i],context);function contentProjectWithName(project)
  5886. {return!!project.url()&&project.type()===WebInspector.projectTypes.ContentScripts;}},_onProjectAdded:function(event)
  5887. {var project=(event.data);if(project.type()!==WebInspector.projectTypes.ContentScripts)
  5888. return;var targets=WebInspector.targetManager.targets();var contexts=[];for(var i=0;i<targets.length;++i)
  5889. contexts=contexts.concat(targets[i].runtimeModel.executionContexts());contexts=contexts.filter(contextWithOriginAndName);for(var i=0;i<contexts.length;++i)
  5890. WebInspector.ContentScriptProjectDecorator._updateProjectWithExtensionName(project,contexts[i]);function contextWithOriginAndName(context)
  5891. {return!!context.origin&&!!context.name;}}};WebInspector.View=function(isWebComponent)
  5892. {this.contentElement=createElementWithClass("div","view");if(isWebComponent){WebInspector.installComponentRootStyles(this.contentElement);this.element=createElementWithClass("div","vbox flex-auto");this._shadowRoot=this.element.createShadowRoot();this._shadowRoot.appendChild(this.contentElement);}else{this.element=this.contentElement;}
  5893. this._isWebComponent=isWebComponent;this.element.__view=this;this._visible=true;this._isRoot=false;this._isShowing=false;this._children=[];this._hideOnDetach=false;this._cssFiles=[];this._notificationDepth=0;}
  5894. WebInspector.View.createStyleElement=function(cssFile)
  5895. {var content=Runtime.cachedResources[cssFile]||"";if(!content)
  5896. console.error(cssFile+" not preloaded. Check module.json");var styleElement=createElement("style");styleElement.type="text/css";styleElement.textContent=content;return styleElement;}
  5897. WebInspector.View.prototype={markAsRoot:function()
  5898. {WebInspector.installComponentRootStyles(this.element);WebInspector.View.__assert(!this.element.parentElement,"Attempt to mark as root attached node");this._isRoot=true;},parentView:function()
  5899. {return this._parentView;},children:function()
  5900. {return this._children;},childWasDetached:function(view)
  5901. {},isShowing:function()
  5902. {return this._isShowing;},_shouldHideOnDetach:function()
  5903. {if(this._hideOnDetach)
  5904. return true;for(var child of this._children){if(child._shouldHideOnDetach())
  5905. return true;}
  5906. return false;},setHideOnDetach:function()
  5907. {this._hideOnDetach=true;},_inNotification:function()
  5908. {return!!this._notificationDepth||(this._parentView&&this._parentView._inNotification());},_parentIsShowing:function()
  5909. {if(this._isRoot)
  5910. return true;return this._parentView&&this._parentView.isShowing();},_callOnVisibleChildren:function(method)
  5911. {var copy=this._children.slice();for(var i=0;i<copy.length;++i){if(copy[i]._parentView===this&©[i]._visible)
  5912. method.call(copy[i]);}},_processWillShow:function()
  5913. {this._callOnVisibleChildren(this._processWillShow);this._isShowing=true;},_processWasShown:function()
  5914. {if(this._inNotification())
  5915. return;this.restoreScrollPositions();this._notify(this.wasShown);this._callOnVisibleChildren(this._processWasShown);},_processWillHide:function()
  5916. {if(this._inNotification())
  5917. return;this.storeScrollPositions();this._callOnVisibleChildren(this._processWillHide);this._notify(this.willHide);this._isShowing=false;},_processWasHidden:function()
  5918. {this._callOnVisibleChildren(this._processWasHidden);},_processOnResize:function()
  5919. {if(this._inNotification())
  5920. return;if(!this.isShowing())
  5921. return;this._notify(this.onResize);this._callOnVisibleChildren(this._processOnResize);},_notify:function(notification)
  5922. {++this._notificationDepth;try{notification.call(this);}finally{--this._notificationDepth;}},wasShown:function()
  5923. {},willHide:function()
  5924. {},onResize:function()
  5925. {},onLayout:function()
  5926. {},show:function(parentElement,insertBefore)
  5927. {WebInspector.View.__assert(parentElement,"Attempt to attach view with no parent element");if(this.element.parentElement!==parentElement){if(this.element.parentElement)
  5928. this.detach();var currentParent=parentElement;while(currentParent&&!currentParent.__view)
  5929. currentParent=currentParent.parentElementOrShadowHost();if(currentParent){this._parentView=currentParent.__view;this._parentView._children.push(this);this._isRoot=false;}else
  5930. WebInspector.View.__assert(this._isRoot,"Attempt to attach view to orphan node");}else if(this._visible){return;}
  5931. this._visible=true;if(this._parentIsShowing())
  5932. this._processWillShow();this.element.classList.add("visible");if(this.element.parentElement!==parentElement){WebInspector.View._incrementViewCounter(parentElement,this.element);if(insertBefore)
  5933. WebInspector.View._originalInsertBefore.call(parentElement,this.element,insertBefore);else
  5934. WebInspector.View._originalAppendChild.call(parentElement,this.element);}
  5935. if(this._parentIsShowing())
  5936. this._processWasShown();if(this._parentView&&this._hasNonZeroConstraints())
  5937. this._parentView.invalidateConstraints();else
  5938. this._processOnResize();},detach:function(overrideHideOnDetach)
  5939. {var parentElement=this.element.parentElement;if(!parentElement)
  5940. return;if(this._parentIsShowing())
  5941. this._processWillHide();if(!overrideHideOnDetach&&this._shouldHideOnDetach()){this.element.classList.remove("visible");this._visible=false;if(this._parentIsShowing())
  5942. this._processWasHidden();if(this._parentView&&this._hasNonZeroConstraints())
  5943. this._parentView.invalidateConstraints();return;}
  5944. WebInspector.View._decrementViewCounter(parentElement,this.element);WebInspector.View._originalRemoveChild.call(parentElement,this.element);this._visible=false;if(this._parentIsShowing())
  5945. this._processWasHidden();if(this._parentView){var childIndex=this._parentView._children.indexOf(this);WebInspector.View.__assert(childIndex>=0,"Attempt to remove non-child view");this._parentView._children.splice(childIndex,1);this._parentView.childWasDetached(this);var parent=this._parentView;this._parentView=null;if(this._hasNonZeroConstraints())
  5946. parent.invalidateConstraints();}else
  5947. WebInspector.View.__assert(this._isRoot,"Removing non-root view from DOM");},detachChildViews:function()
  5948. {var children=this._children.slice();for(var i=0;i<children.length;++i)
  5949. children[i].detach();},elementsToRestoreScrollPositionsFor:function()
  5950. {return[this.element];},storeScrollPositions:function()
  5951. {var elements=this.elementsToRestoreScrollPositionsFor();for(var i=0;i<elements.length;++i){var container=elements[i];container._scrollTop=container.scrollTop;container._scrollLeft=container.scrollLeft;}},restoreScrollPositions:function()
  5952. {var elements=this.elementsToRestoreScrollPositionsFor();for(var i=0;i<elements.length;++i){var container=elements[i];if(container._scrollTop)
  5953. container.scrollTop=container._scrollTop;if(container._scrollLeft)
  5954. container.scrollLeft=container._scrollLeft;}},doResize:function()
  5955. {if(!this.isShowing())
  5956. return;if(!this._inNotification())
  5957. this._callOnVisibleChildren(this._processOnResize);},doLayout:function()
  5958. {if(!this.isShowing())
  5959. return;this._notify(this.onLayout);this.doResize();},registerRequiredCSS:function(cssFile)
  5960. {(this._isWebComponent?this._shadowRoot:this.element).appendChild(WebInspector.View.createStyleElement(cssFile));},printViewHierarchy:function()
  5961. {var lines=[];this._collectViewHierarchy("",lines);console.log(lines.join("\n"));},_collectViewHierarchy:function(prefix,lines)
  5962. {lines.push(prefix+"["+this.element.className+"]"+(this._children.length?" {":""));for(var i=0;i<this._children.length;++i)
  5963. this._children[i]._collectViewHierarchy(prefix+"    ",lines);if(this._children.length)
  5964. lines.push(prefix+"}");},defaultFocusedElement:function()
  5965. {return this._defaultFocusedElement||this.element;},setDefaultFocusedElement:function(element)
  5966. {this._defaultFocusedElement=element;},focus:function()
  5967. {var element=this.defaultFocusedElement();if(!element||element.isAncestor(this.element.ownerDocument.activeElement))
  5968. return;WebInspector.setCurrentFocusElement(element);},hasFocus:function()
  5969. {var activeElement=this.element.ownerDocument.activeElement;return activeElement&&activeElement.isSelfOrDescendant(this.element);},measurePreferredSize:function()
  5970. {var document=this.element.ownerDocument;WebInspector.View._originalAppendChild.call(document.body,this.element);this.element.positionAt(0,0);var result=new Size(this.element.offsetWidth,this.element.offsetHeight);this.element.positionAt(undefined,undefined);WebInspector.View._originalRemoveChild.call(document.body,this.element);return result;},calculateConstraints:function()
  5971. {return new Constraints();},constraints:function()
  5972. {if(typeof this._constraints!=="undefined")
  5973. return this._constraints;if(typeof this._cachedConstraints==="undefined")
  5974. this._cachedConstraints=this.calculateConstraints();return this._cachedConstraints;},setMinimumAndPreferredSizes:function(width,height,preferredWidth,preferredHeight)
  5975. {this._constraints=new Constraints(new Size(width,height),new Size(preferredWidth,preferredHeight));this.invalidateConstraints();},setMinimumSize:function(width,height)
  5976. {this._constraints=new Constraints(new Size(width,height));this.invalidateConstraints();},_hasNonZeroConstraints:function()
  5977. {var constraints=this.constraints();return!!(constraints.minimum.width||constraints.minimum.height||constraints.preferred.width||constraints.preferred.height);},invalidateConstraints:function()
  5978. {var cached=this._cachedConstraints;delete this._cachedConstraints;var actual=this.constraints();if(!actual.isEqual(cached)&&this._parentView)
  5979. this._parentView.invalidateConstraints();else
  5980. this.doLayout();},__proto__:WebInspector.Object.prototype}
  5981. WebInspector.View._originalAppendChild=Element.prototype.appendChild;WebInspector.View._originalInsertBefore=Element.prototype.insertBefore;WebInspector.View._originalRemoveChild=Element.prototype.removeChild;WebInspector.View._originalRemoveChildren=Element.prototype.removeChildren;WebInspector.View._incrementViewCounter=function(parentElement,childElement)
  5982. {var count=(childElement.__viewCounter||0)+(childElement.__view?1:0);if(!count)
  5983. return;while(parentElement){parentElement.__viewCounter=(parentElement.__viewCounter||0)+count;parentElement=parentElement.parentElementOrShadowHost();}}
  5984. WebInspector.View._decrementViewCounter=function(parentElement,childElement)
  5985. {var count=(childElement.__viewCounter||0)+(childElement.__view?1:0);if(!count)
  5986. return;while(parentElement){parentElement.__viewCounter-=count;parentElement=parentElement.parentElementOrShadowHost();}}
  5987. WebInspector.View.__assert=function(condition,message)
  5988. {if(!condition){console.trace();throw new Error(message);}}
  5989. WebInspector.VBox=function(isWebComponent)
  5990. {WebInspector.View.call(this,isWebComponent);this.contentElement.classList.add("vbox");};WebInspector.VBox.prototype={calculateConstraints:function()
  5991. {var constraints=new Constraints();function updateForChild()
  5992. {var child=this.constraints();constraints=constraints.widthToMax(child);constraints=constraints.addHeight(child);}
  5993. this._callOnVisibleChildren(updateForChild);return constraints;},__proto__:WebInspector.View.prototype};WebInspector.HBox=function(isWebComponent)
  5994. {WebInspector.View.call(this,isWebComponent);this.contentElement.classList.add("hbox");};WebInspector.HBox.prototype={calculateConstraints:function()
  5995. {var constraints=new Constraints();function updateForChild()
  5996. {var child=this.constraints();constraints=constraints.addWidth(child);constraints=constraints.heightToMax(child);}
  5997. this._callOnVisibleChildren(updateForChild);return constraints;},__proto__:WebInspector.View.prototype};WebInspector.VBoxWithResizeCallback=function(resizeCallback)
  5998. {WebInspector.VBox.call(this);this._resizeCallback=resizeCallback;}
  5999. WebInspector.VBoxWithResizeCallback.prototype={onResize:function()
  6000. {this._resizeCallback();},__proto__:WebInspector.VBox.prototype}
  6001. Element.prototype.appendChild=function(child)
  6002. {WebInspector.View.__assert(!child.__view||child.parentElement===this,"Attempt to add view via regular DOM operation.");return WebInspector.View._originalAppendChild.call(this,child);}
  6003. Element.prototype.insertBefore=function(child,anchor)
  6004. {WebInspector.View.__assert(!child.__view||child.parentElement===this,"Attempt to add view via regular DOM operation.");return WebInspector.View._originalInsertBefore.call(this,child,anchor);}
  6005. Element.prototype.removeChild=function(child)
  6006. {WebInspector.View.__assert(!child.__viewCounter&&!child.__view,"Attempt to remove element containing view via regular DOM operation");return WebInspector.View._originalRemoveChild.call(this,child);}
  6007. Element.prototype.removeChildren=function()
  6008. {WebInspector.View.__assert(!this.__viewCounter,"Attempt to remove element containing view via regular DOM operation");WebInspector.View._originalRemoveChildren.call(this);};function TreeContainerNode()
  6009. {this.children=[];}
  6010. TreeContainerNode.prototype={treeElementFromPoint:function(x,y)
  6011. {var node=this._childrenListNode.ownerDocument.deepElementFromPoint(x,y);if(!node)
  6012. return null;var listNode=node.enclosingNodeOrSelfWithNodeNameInArray(["ol","li"]);if(listNode)
  6013. return listNode.parentTreeElement||listNode.treeElement;return null;},treeElementFromEvent:function(event)
  6014. {return event?this.treeElementFromPoint(event.pageX,event.pageY):null;},hasAncestor:function(ancestor){if(!ancestor)
  6015. return false;var currentNode=this.parent;while(currentNode){if(ancestor===currentNode)
  6016. return true;currentNode=currentNode.parent;}
  6017. return false;},appendChild:function(child)
  6018. {var insertionIndex;if(this.treeOutline.comparator)
  6019. insertionIndex=insertionIndexForObjectInListSortedByFunction(child,this.children,this.treeOutline.comparator);else
  6020. insertionIndex=this.children.length;this.insertChild(child,insertionIndex);},insertBeforeChild:function(child,beforeChild)
  6021. {if(!child)
  6022. throw("child can't be undefined or null");if(!beforeChild)
  6023. throw("beforeChild can't be undefined or null");var childIndex=this.children.indexOf(beforeChild);if(childIndex===-1)
  6024. throw("beforeChild not found in this node's children");this.insertChild(child,childIndex);},insertChild:function(child,index)
  6025. {if(!child)
  6026. throw("child can't be undefined or null");var previousChild=(index>0?this.children[index-1]:null);if(previousChild){previousChild.nextSibling=child;child.previousSibling=previousChild;}else{child.previousSibling=null;}
  6027. var nextChild=this.children[index];if(nextChild){nextChild.previousSibling=child;child.nextSibling=nextChild;}else{child.nextSibling=null;}
  6028. this.children.splice(index,0,child);this.hasChildren=true;child.parent=this;child.treeOutline=this.treeOutline;child.treeOutline._rememberTreeElement(child);var current=child.children[0];while(current){current.treeOutline=this.treeOutline;current.treeOutline._rememberTreeElement(current);current=current.traverseNextTreeElement(false,child,true);}
  6029. if(child.hasChildren&&child.treeOutline._expandedElementIdentities.has(child.elementIdentity()))
  6030. child.expanded=true;if(!this._childrenListNode){this._childrenListNode=this.treeOutline._childrenListNode.ownerDocument.createElement("ol");this._childrenListNode.parentTreeElement=this;this._childrenListNode.classList.add("children");if(this.hidden)
  6031. this._childrenListNode.classList.add("hidden");}
  6032. child._attach();},removeChildAtIndex:function(childIndex)
  6033. {if(childIndex<0||childIndex>=this.children.length)
  6034. throw("childIndex out of range");var child=this.children[childIndex];this.children.splice(childIndex,1);var parent=child.parent;if(child.deselect()){if(child.nextSibling)
  6035. child.nextSibling.select();else if(child.previousSibling)
  6036. child.previousSibling.select();else
  6037. parent.select();}
  6038. if(child.previousSibling)
  6039. child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
  6040. child.nextSibling.previousSibling=child.previousSibling;if(child.treeOutline){child.treeOutline._forgetTreeElement(child);child.treeOutline._forgetChildrenRecursive(child);}
  6041. child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;},removeChild:function(child)
  6042. {if(!child)
  6043. throw("child can't be undefined or null");var childIndex=this.children.indexOf(child);if(childIndex===-1)
  6044. throw("child not found in this node's children");this.removeChildAtIndex(childIndex);},removeChildren:function()
  6045. {for(var i=0;i<this.children.length;++i){var child=this.children[i];child.deselect();if(child.treeOutline){child.treeOutline._forgetTreeElement(child);child.treeOutline._forgetChildrenRecursive(child);}
  6046. child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
  6047. this.children=[];},expand:function()
  6048. {},collapse:function()
  6049. {},revealed:function()
  6050. {return true;},reveal:function()
  6051. {},revealAndSelect:function(omitFocus)
  6052. {},select:function(omitFocus,selectedByUser)
  6053. {return false;},deselect:function(supressOnDeselect)
  6054. {return false;}}
  6055. function TreeOutline(listNode,nonFocusable)
  6056. {TreeContainerNode.call(this);this.selectedTreeElement=null;this._childrenListNode=listNode;this.childrenListElement=this._childrenListNode;this._childrenListNode.removeChildren();this.expandTreeElementsWhenArrowing=false;this.root=true;this.hasChildren=false;this.expanded=true;this.selected=false;this.treeOutline=this;this.comparator=null;this.setFocusable(!nonFocusable);this._childrenListNode.addEventListener("keydown",this._treeKeyDown.bind(this),true);this._treeElementsMap=new Map();this._expandedElementIdentities=new Set();this.element=listNode;}
  6057. TreeOutline.prototype={setFocusable:function(focusable)
  6058. {if(focusable)
  6059. this._childrenListNode.setAttribute("tabIndex",0);else
  6060. this._childrenListNode.removeAttribute("tabIndex");},_rememberTreeElement:function(element)
  6061. {var elements=this._treeElementsMap.get(element.representedObject);if(!elements){elements=[];this._treeElementsMap.set(element.representedObject,elements);}
  6062. if(elements.indexOf(element)!==-1)
  6063. return;elements.push(element);},_forgetTreeElement:function(element)
  6064. {var elements=this._treeElementsMap.get(element.representedObject);if(elements){elements.remove(element,true);if(!elements.length)
  6065. this._treeElementsMap.remove(element.representedObject);}},_forgetChildrenRecursive:function(parentElement)
  6066. {var child=parentElement.children[0];while(child){this._forgetTreeElement(child);child=child.traverseNextTreeElement(false,parentElement,true);}},getCachedTreeElement:function(representedObject)
  6067. {if(!representedObject)
  6068. return null;var elements=this._treeElementsMap.get(representedObject);if(elements&&elements.length)
  6069. return elements[0];return null;},_elementExpanded:function(element)
  6070. {this._expandedElementIdentities.add(element.elementIdentity());},_elementCollapsed:function(element)
  6071. {this._expandedElementIdentities.delete(element.elementIdentity());},_treeKeyDown:function(event)
  6072. {if(event.target!==this._childrenListNode)
  6073. return;if(!this.selectedTreeElement||event.shiftKey||event.metaKey||event.ctrlKey)
  6074. return;var handled=false;var nextSelectedElement;if(event.keyIdentifier==="Up"&&!event.altKey){nextSelectedElement=this.selectedTreeElement.traversePreviousTreeElement(true);while(nextSelectedElement&&!nextSelectedElement.selectable)
  6075. nextSelectedElement=nextSelectedElement.traversePreviousTreeElement(!this.expandTreeElementsWhenArrowing);handled=nextSelectedElement?true:false;}else if(event.keyIdentifier==="Down"&&!event.altKey){nextSelectedElement=this.selectedTreeElement.traverseNextTreeElement(true);while(nextSelectedElement&&!nextSelectedElement.selectable)
  6076. nextSelectedElement=nextSelectedElement.traverseNextTreeElement(!this.expandTreeElementsWhenArrowing);handled=nextSelectedElement?true:false;}else if(event.keyIdentifier==="Left"){if(this.selectedTreeElement.expanded){if(event.altKey)
  6077. this.selectedTreeElement.collapseRecursively();else
  6078. this.selectedTreeElement.collapse();handled=true;}else if(this.selectedTreeElement.parent&&!this.selectedTreeElement.parent.root){handled=true;if(this.selectedTreeElement.parent.selectable){nextSelectedElement=this.selectedTreeElement.parent;while(nextSelectedElement&&!nextSelectedElement.selectable)
  6079. nextSelectedElement=nextSelectedElement.parent;handled=nextSelectedElement?true:false;}else if(this.selectedTreeElement.parent)
  6080. this.selectedTreeElement.parent.collapse();}}else if(event.keyIdentifier==="Right"){if(!this.selectedTreeElement.revealed()){this.selectedTreeElement.reveal();handled=true;}else if(this.selectedTreeElement.hasChildren){handled=true;if(this.selectedTreeElement.expanded){nextSelectedElement=this.selectedTreeElement.children[0];while(nextSelectedElement&&!nextSelectedElement.selectable)
  6081. nextSelectedElement=nextSelectedElement.nextSibling;handled=nextSelectedElement?true:false;}else{if(event.altKey)
  6082. this.selectedTreeElement.expandRecursively();else
  6083. this.selectedTreeElement.expand();}}}else if(event.keyCode===8||event.keyCode===46)
  6084. handled=this.selectedTreeElement.ondelete();else if(isEnterKey(event))
  6085. handled=this.selectedTreeElement.onenter();else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Space.code)
  6086. handled=this.selectedTreeElement.onspace();if(nextSelectedElement){nextSelectedElement.reveal();nextSelectedElement.select(false,true);}
  6087. if(handled)
  6088. event.consume(true);},__proto__:TreeContainerNode.prototype}
  6089. function TreeElement(title,representedObject,hasChildren)
  6090. {TreeContainerNode.call(this);this._title=title;this.representedObject=representedObject||{};this.root=false;this._hidden=false;this._selectable=true;this.expanded=false;this.selected=false;this.hasChildren=hasChildren;this.treeOutline=null;this.parent=null;this.previousSibling=null;this.nextSibling=null;this._listItemNode=null;}
  6091. TreeElement._ArrowToggleWidth=10;TreeElement.prototype={get selectable(){if(this._hidden)
  6092. return false;return this._selectable;},set selectable(x){this._selectable=x;},get listItemElement(){return this._listItemNode;},get childrenListElement(){return this._childrenListNode;},get title(){return this._title;},set title(x){this._title=x;this._setListItemNodeContent();},get tooltip(){return this._tooltip||"";},set tooltip(x){this._tooltip=x;if(!this._listItemNode)
  6093. return;if(x)
  6094. this._listItemNode.title=x;else
  6095. this._listItemNode.removeAttribute("title");},get hasChildren(){return this._hasChildren;},setHasChildren:function(hasChildren)
  6096. {this.hasChildren=hasChildren;},set hasChildren(x){if(this._hasChildren===x)
  6097. return;this._hasChildren=x;if(!this._listItemNode)
  6098. return;if(x){this._listItemNode.classList.add("parent");if(this.treeOutline._expandedElementIdentities.has(this.elementIdentity()))
  6099. this.expand();}else{this._listItemNode.classList.remove("parent");this.collapse();}},get hidden(){return this._hidden;},set hidden(x){if(this._hidden===x)
  6100. return;this._hidden=x;if(x){if(this._listItemNode)
  6101. this._listItemNode.classList.add("hidden");if(this._childrenListNode)
  6102. this._childrenListNode.classList.add("hidden");}else{if(this._listItemNode)
  6103. this._listItemNode.classList.remove("hidden");if(this._childrenListNode)
  6104. this._childrenListNode.classList.remove("hidden");}},get shouldRefreshChildren(){return this._shouldRefreshChildren;},set shouldRefreshChildren(x){this._shouldRefreshChildren=x;if(x&&this.expanded)
  6105. this.expand();},_setListItemNodeContent:function()
  6106. {if(!this._listItemNode)
  6107. return;if(typeof this._title==="string")
  6108. this._listItemNode.textContent=this._title;else{this._listItemNode.removeChildren();if(this._title)
  6109. this._listItemNode.appendChild(this._title);}},_attach:function()
  6110. {if(!this._listItemNode||this.parent._shouldRefreshChildren){if(this._listItemNode&&this._listItemNode.parentNode)
  6111. this._listItemNode.parentNode.removeChild(this._listItemNode);this._listItemNode=this.treeOutline._childrenListNode.ownerDocument.createElement("li");this._listItemNode.treeElement=this;this._setListItemNodeContent();this.tooltip=this._tooltip;if(this.hidden)
  6112. this._listItemNode.classList.add("hidden");if(this.hasChildren)
  6113. this._listItemNode.classList.add("parent");if(this.expanded)
  6114. this._listItemNode.classList.add("expanded");if(this.selected)
  6115. this._listItemNode.classList.add("selected");this._listItemNode.addEventListener("mousedown",this._handleMouseDown.bind(this),false);this._listItemNode.addEventListener("selectstart",treeElementSelectStart,false);this._listItemNode.addEventListener("click",this._treeElementToggled.bind(this),false);this._listItemNode.addEventListener("dblclick",this._handleDoubleClick.bind(this),false);this.onattach();}
  6116. function treeElementSelectStart(event)
  6117. {event.currentTarget._selectionStarted=true;}
  6118. var nextSibling=null;if(this.nextSibling&&this.nextSibling._listItemNode&&this.nextSibling._listItemNode.parentNode===this.parent._childrenListNode)
  6119. nextSibling=this.nextSibling._listItemNode;this.parent._childrenListNode.insertBefore(this._listItemNode,nextSibling);if(this._childrenListNode)
  6120. this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);if(this.selected)
  6121. this.select();if(this.expanded)
  6122. this.expand();},_treeElementToggled:function(event)
  6123. {var element=event.currentTarget;if(element._selectionStarted){delete element._selectionStarted;var selection=element.window().getSelection();if(selection&&!selection.isCollapsed&&element.isSelfOrAncestor(selection.anchorNode)&&element.isSelfOrAncestor(selection.focusNode))
  6124. return;}
  6125. if(element.treeElement!==this)
  6126. return;var toggleOnClick=this.toggleOnClick&&!this.selectable;var isInTriangle=this.isEventWithinDisclosureTriangle(event);if(!toggleOnClick&&!isInTriangle)
  6127. return;if(event.target&&event.target.enclosingNodeOrSelfWithNodeName("a"))
  6128. return;if(this.expanded){if(event.altKey)
  6129. this.collapseRecursively();else
  6130. this.collapse();}else{if(event.altKey)
  6131. this.expandRecursively();else
  6132. this.expand();}
  6133. event.consume();},_handleMouseDown:function(event)
  6134. {var element=event.currentTarget;if(!element)
  6135. return;delete element._selectionStarted;if(!this.selectable)
  6136. return;if(element.treeElement!==this)
  6137. return;if(this.isEventWithinDisclosureTriangle(event))
  6138. return;this.selectOnMouseDown(event);},_handleDoubleClick:function(event)
  6139. {var element=event.currentTarget;if(!element||element.treeElement!==this)
  6140. return;var handled=this.ondblclick(event);if(handled)
  6141. return;if(this.hasChildren&&!this.expanded)
  6142. this.expand();},_detach:function()
  6143. {if(this._listItemNode&&this._listItemNode.parentNode)
  6144. this._listItemNode.parentNode.removeChild(this._listItemNode);if(this._childrenListNode&&this._childrenListNode.parentNode)
  6145. this._childrenListNode.parentNode.removeChild(this._childrenListNode);},elementIdentity:function()
  6146. {return this.representedObject;},collapse:function()
  6147. {if(this._listItemNode)
  6148. this._listItemNode.classList.remove("expanded");if(this._childrenListNode)
  6149. this._childrenListNode.classList.remove("expanded");this.expanded=false;if(this.treeOutline)
  6150. this.treeOutline._elementCollapsed(this);this.oncollapse();},collapseRecursively:function()
  6151. {var item=this;while(item){if(item.expanded)
  6152. item.collapse();item=item.traverseNextTreeElement(false,this,true);}},expand:function()
  6153. {if(!this.hasChildren||(this.expanded&&!this._shouldRefreshChildren&&this._childrenListNode))
  6154. return;this.expanded=true;if(this.treeOutline)
  6155. this.treeOutline._elementExpanded(this);if(this.treeOutline&&(!this._childrenListNode||this._shouldRefreshChildren)){if(this._childrenListNode&&this._childrenListNode.parentNode)
  6156. this._childrenListNode.parentNode.removeChild(this._childrenListNode);this._childrenListNode=this.treeOutline._childrenListNode.ownerDocument.createElement("ol");this._childrenListNode.parentTreeElement=this;this._childrenListNode.classList.add("children");if(this.hidden)
  6157. this._childrenListNode.classList.add("hidden");this.onpopulate();for(var i=0;i<this.children.length;++i)
  6158. this.children[i]._attach();delete this._shouldRefreshChildren;}
  6159. if(this._listItemNode){this._listItemNode.classList.add("expanded");if(this._childrenListNode&&this._childrenListNode.parentNode!=this._listItemNode.parentNode)
  6160. this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);}
  6161. if(this._childrenListNode)
  6162. this._childrenListNode.classList.add("expanded");this.onexpand();},expandRecursively:function(maxDepth)
  6163. {var item=this;var info={};var depth=0;if(isNaN(maxDepth))
  6164. maxDepth=3;while(item){if(depth<maxDepth)
  6165. item.expand();item=item.traverseNextTreeElement(false,this,(depth>=maxDepth),info);depth+=info.depthChange;}},reveal:function()
  6166. {var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
  6167. currentAncestor.expand();currentAncestor=currentAncestor.parent;}
  6168. this.listItemElement.scrollIntoViewIfNeeded();this.onreveal();},revealed:function()
  6169. {var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
  6170. return false;currentAncestor=currentAncestor.parent;}
  6171. return true;},selectOnMouseDown:function(event)
  6172. {if(this.select(false,true))
  6173. event.consume(true);},select:function(omitFocus,selectedByUser)
  6174. {if(!this.treeOutline||!this.selectable||this.selected)
  6175. return false;if(this.treeOutline.selectedTreeElement)
  6176. this.treeOutline.selectedTreeElement.deselect();this.selected=true;if(!omitFocus)
  6177. this.treeOutline._childrenListNode.focus();if(!this.treeOutline)
  6178. return false;this.treeOutline.selectedTreeElement=this;if(this._listItemNode)
  6179. this._listItemNode.classList.add("selected");return this.onselect(selectedByUser);},revealAndSelect:function(omitFocus)
  6180. {this.reveal();this.select(omitFocus);},deselect:function(supressOnDeselect)
  6181. {if(!this.treeOutline||this.treeOutline.selectedTreeElement!==this||!this.selected)
  6182. return false;this.selected=false;this.treeOutline.selectedTreeElement=null;if(this._listItemNode)
  6183. this._listItemNode.classList.remove("selected");return true;},onpopulate:function()
  6184. {},onenter:function()
  6185. {return false;},ondelete:function()
  6186. {return false;},onspace:function()
  6187. {return false;},onattach:function()
  6188. {},onexpand:function()
  6189. {},oncollapse:function()
  6190. {},ondblclick:function(e)
  6191. {return false;},onreveal:function()
  6192. {},onselect:function(selectedByUser)
  6193. {return false;},traverseNextTreeElement:function(skipUnrevealed,stayWithin,dontPopulate,info)
  6194. {if(!dontPopulate&&this.hasChildren)
  6195. this.onpopulate();if(info)
  6196. info.depthChange=0;var element=skipUnrevealed?(this.revealed()?this.children[0]:null):this.children[0];if(element&&(!skipUnrevealed||(skipUnrevealed&&this.expanded))){if(info)
  6197. info.depthChange=1;return element;}
  6198. if(this===stayWithin)
  6199. return null;element=skipUnrevealed?(this.revealed()?this.nextSibling:null):this.nextSibling;if(element)
  6200. return element;element=this;while(element&&!element.root&&!(skipUnrevealed?(element.revealed()?element.nextSibling:null):element.nextSibling)&&element.parent!==stayWithin){if(info)
  6201. info.depthChange-=1;element=element.parent;}
  6202. if(!element)
  6203. return null;return(skipUnrevealed?(element.revealed()?element.nextSibling:null):element.nextSibling);},traversePreviousTreeElement:function(skipUnrevealed,dontPopulate)
  6204. {var element=skipUnrevealed?(this.revealed()?this.previousSibling:null):this.previousSibling;if(!dontPopulate&&element&&element.hasChildren)
  6205. element.onpopulate();while(element&&(skipUnrevealed?(element.revealed()&&element.expanded?element.children[element.children.length-1]:null):element.children[element.children.length-1])){if(!dontPopulate&&element.hasChildren)
  6206. element.onpopulate();element=(skipUnrevealed?(element.revealed()&&element.expanded?element.children[element.children.length-1]:null):element.children[element.children.length-1]);}
  6207. if(element)
  6208. return element;if(!this.parent||this.parent.root)
  6209. return null;return this.parent;},isEventWithinDisclosureTriangle:function(event)
  6210. {var paddingLeftValue=window.getComputedStyle(this._listItemNode).paddingLeft;console.assert(paddingLeftValue.endsWith("px"));var computedLeftPadding=parseFloat(paddingLeftValue);var left=this._listItemNode.totalOffsetLeft()+computedLeftPadding;return event.pageX>=left&&event.pageX<=left+TreeElement._ArrowToggleWidth&&this.hasChildren;},__proto__:TreeContainerNode.prototype};WebInspector.ActionRegistry=function()
  6211. {this._actionsById=new Map();this._registerActions();}
  6212. WebInspector.ActionRegistry.prototype={_registerActions:function()
  6213. {self.runtime.extensions(WebInspector.ActionDelegate).forEach(registerExtension,this);function registerExtension(extension)
  6214. {var actionId=extension.descriptor()["actionId"];console.assert(actionId);console.assert(!this._actionsById.get(actionId));this._actionsById.set(actionId,extension);}},applicableActions:function(actionIds,context)
  6215. {var extensions=[];actionIds.forEach(function(actionId){var extension=this._actionsById.get(actionId);if(extension)
  6216. extensions.push(extension);},this);return context.applicableExtensions(extensions).valuesArray().map(function(extension){return extension.descriptor()["actionId"];});},execute:function(actionId)
  6217. {var extension=this._actionsById.get(actionId);console.assert(extension,"No action found for actionId '"+actionId+"'");return extension.instancePromise().then(handleAction);function handleAction(actionDelegate)
  6218. {return(actionDelegate).handleAction(WebInspector.context);}}}
  6219. WebInspector.ActionDelegate=function()
  6220. {}
  6221. WebInspector.ActionDelegate.prototype={handleAction:function(context){}}
  6222. WebInspector.actionRegistry;;WebInspector.ShortcutRegistry=function(actionRegistry,document)
  6223. {this._actionRegistry=actionRegistry;this._defaultKeyToActions=new StringMultimap();this._defaultActionToShortcut=new StringMultimap();this._registerBindings(document);}
  6224. WebInspector.ShortcutRegistry.prototype={applicableActions:function(key)
  6225. {return this._actionRegistry.applicableActions(this._defaultActionsForKey(key).valuesArray(),WebInspector.context);},_defaultActionsForKey:function(key)
  6226. {return this._defaultKeyToActions.get(String(key));},shortcutDescriptorsForAction:function(actionId)
  6227. {return this._defaultActionToShortcut.get(actionId).valuesArray();},keysForActions:function(actionIds)
  6228. {var result=[];for(var i=0;i<actionIds.length;++i){var descriptors=this.shortcutDescriptorsForAction(actionIds[i]);for(var j=0;j<descriptors.length;++j)
  6229. result.push(descriptors[j].key);}
  6230. return result;},handleShortcut:function(event)
  6231. {this.handleKey(WebInspector.KeyboardShortcut.makeKeyFromEvent(event),event.keyIdentifier,event);},handleKey:function(key,keyIdentifier,event)
  6232. {var keyModifiers=key>>8;var actionIds=this.applicableActions(key);if(!actionIds.length)
  6233. return;if(WebInspector.GlassPane.DefaultFocusedViewStack.length>1){if(event&&!isPossiblyInputKey())
  6234. event.consume(true);return;}
  6235. if(!isPossiblyInputKey()){if(event)
  6236. event.consume(true);processActionIdsSequentially.call(this);}else{this._pendingActionTimer=setTimeout(processActionIdsSequentially.bind(this),0);}
  6237. function processActionIdsSequentially()
  6238. {delete this._pendingActionTimer;var actionId=actionIds.shift();if(!actionId)
  6239. return;this._actionRegistry.execute(actionId).then(continueIfNecessary.bind(this));function continueIfNecessary(result)
  6240. {if(result)
  6241. return;processActionIdsSequentially.call(this);}}
  6242. function isPossiblyInputKey()
  6243. {if(!event||!WebInspector.isEditing()||/^F\d+|Control|Shift|Alt|Meta|Win|U\+001B$/.test(keyIdentifier))
  6244. return false;if(!keyModifiers)
  6245. return true;var modifiers=WebInspector.KeyboardShortcut.Modifiers;if((keyModifiers&(modifiers.Ctrl|modifiers.Alt))===(modifiers.Ctrl|modifiers.Alt))
  6246. return WebInspector.isWin();return!hasModifier(modifiers.Ctrl)&&!hasModifier(modifiers.Alt)&&!hasModifier(modifiers.Meta);}
  6247. function hasModifier(mod)
  6248. {return!!(keyModifiers&mod);}},registerShortcut:function(actionId,shortcut)
  6249. {var descriptor=WebInspector.KeyboardShortcut.makeDescriptorFromBindingShortcut(shortcut);if(!descriptor)
  6250. return;this._defaultActionToShortcut.set(actionId,descriptor);this._defaultKeyToActions.set(String(descriptor.key),actionId);},dismissPendingShortcutAction:function()
  6251. {if(this._pendingActionTimer){clearTimeout(this._pendingActionTimer);delete this._pendingActionTimer;}},_registerBindings:function(document)
  6252. {document.addEventListener("input",this.dismissPendingShortcutAction.bind(this),true);var extensions=self.runtime.extensions(WebInspector.ActionDelegate);extensions.forEach(registerExtension,this);function registerExtension(extension)
  6253. {var descriptor=extension.descriptor();var bindings=descriptor["bindings"];for(var i=0;bindings&&i<bindings.length;++i){if(!platformMatches(bindings[i].platform))
  6254. continue;var shortcuts=bindings[i]["shortcut"].split(/\s+/);shortcuts.forEach(this.registerShortcut.bind(this,descriptor["actionId"]));}}
  6255. function platformMatches(platformsString)
  6256. {if(!platformsString)
  6257. return true;var platforms=platformsString.split(",");var isMatch=false;var currentPlatform=WebInspector.platform();for(var i=0;!isMatch&&i<platforms.length;++i)
  6258. isMatch=platforms[i]===currentPlatform;return isMatch;}}}
  6259. WebInspector.ShortcutRegistry.ForwardedShortcut=function()
  6260. {}
  6261. WebInspector.ShortcutRegistry.ForwardedShortcut.instance=new WebInspector.ShortcutRegistry.ForwardedShortcut();WebInspector.shortcutRegistry;;WebInspector.CompletionDictionary=function(){}
  6262. WebInspector.CompletionDictionary.prototype={addWord:function(word){},removeWord:function(word){},hasWord:function(word){},wordsWithPrefix:function(prefix){},wordCount:function(word){},reset:function(){}}
  6263. WebInspector.SampleCompletionDictionary=function(){this._words={};}
  6264. WebInspector.SampleCompletionDictionary.prototype={addWord:function(word)
  6265. {if(!this._words[word])
  6266. this._words[word]=1;else
  6267. ++this._words[word];},removeWord:function(word)
  6268. {if(!this._words[word])
  6269. return;if(this._words[word]===1)
  6270. delete this._words[word];else
  6271. --this._words[word];},wordsWithPrefix:function(prefix)
  6272. {var words=[];for(var i in this._words){if(i.startsWith(prefix))
  6273. words.push(i);}
  6274. return words;},hasWord:function(word)
  6275. {return!!this._words[word];},wordCount:function(word)
  6276. {return this._words[word]?this._words[word]:0;},reset:function()
  6277. {this._words={};}};WebInspector.Context=function()
  6278. {this._flavors=new Map();this._eventDispatchers=new Map();}
  6279. WebInspector.Context.Events={FlavorChanged:"FlavorChanged"}
  6280. WebInspector.Context.prototype={setFlavor:function(flavorType,flavorValue)
  6281. {var value=this._flavors.get(flavorType)||null;if(value===flavorValue)
  6282. return;if(flavorValue)
  6283. this._flavors.set(flavorType,flavorValue);else
  6284. this._flavors.remove(flavorType);this._dispatchFlavorChange(flavorType,flavorValue);},_dispatchFlavorChange:function(flavorType,flavorValue)
  6285. {var dispatcher=this._eventDispatchers.get(flavorType);if(!dispatcher)
  6286. return;dispatcher.dispatchEventToListeners(WebInspector.Context.Events.FlavorChanged,flavorValue);},addFlavorChangeListener:function(flavorType,listener,thisObject)
  6287. {var dispatcher=this._eventDispatchers.get(flavorType);if(!dispatcher){dispatcher=new WebInspector.Object();this._eventDispatchers.set(flavorType,dispatcher);}
  6288. dispatcher.addEventListener(WebInspector.Context.Events.FlavorChanged,listener,thisObject);},removeFlavorChangeListener:function(flavorType,listener,thisObject)
  6289. {var dispatcher=this._eventDispatchers.get(flavorType);if(!dispatcher)
  6290. return;dispatcher.removeEventListener(WebInspector.Context.Events.FlavorChanged,listener,thisObject);if(!dispatcher.hasEventListeners(WebInspector.Context.Events.FlavorChanged))
  6291. this._eventDispatchers.remove(flavorType);},flavor:function(flavorType)
  6292. {return this._flavors.get(flavorType)||null;},flavors:function()
  6293. {return new Set(this._flavors.keys());},applicableExtensions:function(extensions)
  6294. {var targetExtensionSet=new Set();var availableFlavors=this.flavors();extensions.forEach(function(extension){if(self.runtime.isExtensionApplicableToContextTypes(extension,availableFlavors))
  6295. targetExtensionSet.add(extension);});return targetExtensionSet;}}
  6296. WebInspector.context=new WebInspector.Context();;WebInspector.ContextMenuItem=function(topLevelMenu,type,label,disabled,checked)
  6297. {this._type=type;this._label=label;this._disabled=disabled;this._checked=checked;this._contextMenu=topLevelMenu;if(type==="item"||type==="checkbox")
  6298. this._id=topLevelMenu.nextId();}
  6299. WebInspector.ContextMenuItem.prototype={id:function()
  6300. {return this._id;},type:function()
  6301. {return this._type;},isEnabled:function()
  6302. {return!this._disabled;},setEnabled:function(enabled)
  6303. {this._disabled=!enabled;},_buildDescriptor:function()
  6304. {switch(this._type){case"item":return{type:"item",id:this._id,label:this._label,enabled:!this._disabled};case"separator":return{type:"separator"};case"checkbox":return{type:"checkbox",id:this._id,label:this._label,checked:!!this._checked,enabled:!this._disabled};}
  6305. throw new Error("Invalid item type:"+this._type);}}
  6306. WebInspector.ContextSubMenuItem=function(topLevelMenu,label,disabled)
  6307. {WebInspector.ContextMenuItem.call(this,topLevelMenu,"subMenu",label,disabled);this._items=[];}
  6308. WebInspector.ContextSubMenuItem.prototype={appendItem:function(label,handler,disabled)
  6309. {var item=new WebInspector.ContextMenuItem(this._contextMenu,"item",label,disabled);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;},appendSubMenuItem:function(label,disabled)
  6310. {var item=new WebInspector.ContextSubMenuItem(this._contextMenu,label,disabled);this._pushItem(item);return item;},appendCheckboxItem:function(label,handler,checked,disabled)
  6311. {var item=new WebInspector.ContextMenuItem(this._contextMenu,"checkbox",label,disabled,checked);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;},appendSeparator:function()
  6312. {if(this._items.length)
  6313. this._pendingSeparator=true;},_pushItem:function(item)
  6314. {if(this._pendingSeparator){this._items.push(new WebInspector.ContextMenuItem(this._contextMenu,"separator"));delete this._pendingSeparator;}
  6315. this._items.push(item);},isEmpty:function()
  6316. {return!this._items.length;},_buildDescriptor:function()
  6317. {var result={type:"subMenu",label:this._label,enabled:!this._disabled,subItems:[]};for(var i=0;i<this._items.length;++i)
  6318. result.subItems.push(this._items[i]._buildDescriptor());return result;},__proto__:WebInspector.ContextMenuItem.prototype}
  6319. WebInspector.ContextMenu=function(event)
  6320. {WebInspector.ContextSubMenuItem.call(this,this,"");this._pendingPromises=[];this._pendingTargets=[];this._event=event;this._x=event.x;this._y=event.y;this._handlers={};this._id=0;}
  6321. WebInspector.ContextMenu.initialize=function()
  6322. {InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.SetUseSoftMenu,setUseSoftMenu);function setUseSoftMenu(event)
  6323. {WebInspector.ContextMenu._useSoftMenu=(event.data);}}
  6324. WebInspector.ContextMenu.installHandler=function(doc)
  6325. {doc.body.addEventListener("contextmenu",handler,false);function handler(event)
  6326. {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicableItems((event.target));contextMenu.show();}}
  6327. WebInspector.ContextMenu.prototype={nextId:function()
  6328. {return this._id++;},show:function()
  6329. {Promise.all(this._pendingPromises).then(populateAndShow.bind(this));WebInspector.ContextMenu._pendingMenu=this;function populateAndShow(appendCallResults)
  6330. {if(WebInspector.ContextMenu._pendingMenu!==this)
  6331. return;delete WebInspector.ContextMenu._pendingMenu;for(var i=0;i<appendCallResults.length;++i){var providers=appendCallResults[i];var target=this._pendingTargets[i];for(var j=0;j<providers.length;++j){var provider=(providers[j]);this.appendSeparator();provider.appendApplicableItems(this._event,this,target);this.appendSeparator();}}
  6332. this._pendingPromises=[];this._pendingTargets=[];this._innerShow();}
  6333. this._event.consume(true);},_innerShow:function()
  6334. {var menuObject=this._buildDescriptors();WebInspector._contextMenu=this;if(WebInspector.ContextMenu._useSoftMenu||InspectorFrontendHost.isHostedMode()){var softMenu=new WebInspector.SoftContextMenu(menuObject,this._itemSelected.bind(this));softMenu.show(this._event.target.ownerDocument,this._x,this._y);}else{InspectorFrontendHost.showContextMenuAtPoint(this._x,this._y,menuObject,this._event.target.ownerDocument);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ContextMenuCleared,this._menuCleared,this);InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ContextMenuItemSelected,this._onItemSelected,this);}},_setHandler:function(id,handler)
  6335. {if(handler)
  6336. this._handlers[id]=handler;},_buildDescriptors:function()
  6337. {var result=[];for(var i=0;i<this._items.length;++i)
  6338. result.push(this._items[i]._buildDescriptor());return result;},_onItemSelected:function(event)
  6339. {this._itemSelected((event.data));},_itemSelected:function(id)
  6340. {if(this._handlers[id])
  6341. this._handlers[id].call(this);this._menuCleared();},_menuCleared:function()
  6342. {InspectorFrontendHost.events.removeEventListener(InspectorFrontendHostAPI.Events.ContextMenuCleared,this._menuCleared,this);InspectorFrontendHost.events.removeEventListener(InspectorFrontendHostAPI.Events.ContextMenuItemSelected,this._onItemSelected,this);},appendApplicableItems:function(target)
  6343. {this._pendingPromises.push(self.runtime.instancesPromise(WebInspector.ContextMenu.Provider,target));this._pendingTargets.push(target);},__proto__:WebInspector.ContextSubMenuItem.prototype}
  6344. WebInspector.ContextMenu.Provider=function(){}
  6345. WebInspector.ContextMenu.Provider.prototype={appendApplicableItems:function(event,contextMenu,target){}};WebInspector.DataGrid=function(columnsArray,editCallback,deleteCallback,refreshCallback,contextMenuCallback)
  6346. {WebInspector.View.call(this);this.registerRequiredCSS("ui/dataGrid.css");this.element.className="data-grid";this.element.tabIndex=0;this.element.addEventListener("keydown",this._keyDown.bind(this),false);var headerContainer=createElementWithClass("div","header-container");this._headerTable=headerContainer.createChild("table","header");this._headerTableHeaders={};this._scrollContainer=createElementWithClass("div","data-container");this._dataTable=this._scrollContainer.createChild("table","data");this._dataTable.addEventListener("mousedown",this._mouseDownInDataTable.bind(this),true);this._dataTable.addEventListener("click",this._clickInDataTable.bind(this),true);this._dataTable.addEventListener("contextmenu",this._contextMenuInDataTable.bind(this),true);if(editCallback)
  6347. this._dataTable.addEventListener("dblclick",this._ondblclick.bind(this),false);this._editCallback=editCallback;this._deleteCallback=deleteCallback;this._refreshCallback=refreshCallback;this._contextMenuCallback=contextMenuCallback;this.element.appendChild(headerContainer);this.element.appendChild(this._scrollContainer);this._headerRow=createElement("tr");this._headerTableColumnGroup=createElement("colgroup");this._dataTableColumnGroup=createElement("colgroup");this._topFillerRow=createElementWithClass("tr","revealed");this._bottomFillerRow=createElementWithClass("tr","revealed");this.setVerticalPadding(0,0);this._columnsArray=columnsArray;this._visibleColumnsArray=columnsArray;this._columns={};this._cellClass=null;for(var i=0;i<columnsArray.length;++i){var column=columnsArray[i];var columnIdentifier=column.identifier=column.id||i;this._columns[columnIdentifier]=column;if(column.disclosure)
  6348. this.disclosureColumnIdentifier=columnIdentifier;var cell=createElement("th");cell.className=columnIdentifier+"-column";cell.columnIdentifier=columnIdentifier;this._headerTableHeaders[columnIdentifier]=cell;var div=createElement("div");if(column.titleDOMFragment)
  6349. div.appendChild(column.titleDOMFragment);else
  6350. div.textContent=column.title;cell.appendChild(div);if(column.sort){cell.classList.add(column.sort);this._sortColumnCell=cell;}
  6351. if(column.sortable){cell.addEventListener("click",this._clickInHeaderCell.bind(this),false);cell.classList.add("sortable");cell.createChild("div","sort-order-icon-container").createChild("div","sort-order-icon");}}
  6352. this._headerTable.appendChild(this._headerTableColumnGroup);this.headerTableBody.appendChild(this._headerRow);this._dataTable.appendChild(this._dataTableColumnGroup);this.dataTableBody.appendChild(this._topFillerRow);this.dataTableBody.appendChild(this._bottomFillerRow);this._refreshHeader();this._editing=false;this.selectedNode=null;this.expandNodesWhenArrowing=false;this.setRootNode(new WebInspector.DataGridNode());this.indentWidth=15;this._resizers=[];this._columnWidthsInitialized=false;this._cornerWidth=WebInspector.DataGrid.CornerWidth;this._resizeMethod=WebInspector.DataGrid.ResizeMethod.Nearest;}
  6353. WebInspector.DataGrid.CornerWidth=14;WebInspector.DataGrid.ColumnDescriptor;WebInspector.DataGrid.Events={SelectedNode:"SelectedNode",DeselectedNode:"DeselectedNode",SortingChanged:"SortingChanged",ColumnsResized:"ColumnsResized"}
  6354. WebInspector.DataGrid.Order={Ascending:"sort-ascending",Descending:"sort-descending"}
  6355. WebInspector.DataGrid.Align={Center:"center",Right:"right"}
  6356. WebInspector.DataGrid.prototype={setCellClass:function(cellClass)
  6357. {this._cellClass=cellClass;},_refreshHeader:function()
  6358. {this._headerTableColumnGroup.removeChildren();this._dataTableColumnGroup.removeChildren();this._headerRow.removeChildren();this._topFillerRow.removeChildren();this._bottomFillerRow.removeChildren();for(var i=0;i<this._visibleColumnsArray.length;++i){var column=this._visibleColumnsArray[i];var columnIdentifier=column.identifier;var headerColumn=this._headerTableColumnGroup.createChild("col");var dataColumn=this._dataTableColumnGroup.createChild("col");if(column.width){headerColumn.style.width=column.width;dataColumn.style.width=column.width;}
  6359. this._headerRow.appendChild(this._headerTableHeaders[columnIdentifier]);this._topFillerRow.createChild("td","top-filler-td");this._bottomFillerRow.createChild("td","bottom-filler-td");}
  6360. this._headerRow.createChild("th","corner");this._topFillerRow.createChild("td","corner").classList.add("top-filler-td");this._bottomFillerRow.createChild("td","corner").classList.add("bottom-filler-td");this._headerTableColumnGroup.createChild("col","corner");this._dataTableColumnGroup.createChild("col","corner");},setVerticalPadding:function(top,bottom)
  6361. {this._topFillerRow.style.height=top+"px";if(top||bottom)
  6362. this._bottomFillerRow.style.height=bottom+"px";else
  6363. this._bottomFillerRow.style.height="auto";},setRootNode:function(rootNode)
  6364. {if(this._rootNode){this._rootNode.removeChildren();this._rootNode.dataGrid=null;this._rootNode._isRoot=false;}
  6365. this._rootNode=rootNode;rootNode._isRoot=true;rootNode.hasChildren=false;rootNode._expanded=true;rootNode._revealed=true;rootNode.dataGrid=this;},rootNode:function()
  6366. {return this._rootNode;},_ondblclick:function(event)
  6367. {if(this._editing||this._editingNode)
  6368. return;var columnIdentifier=this.columnIdentifierFromNode(event.target);if(!columnIdentifier||!this._columns[columnIdentifier].editable)
  6369. return;this._startEditing(event.target);},_startEditingColumnOfDataGridNode:function(node,cellIndex)
  6370. {this._editing=true;this._editingNode=node;this._editingNode.select();var element=this._editingNode._element.children[cellIndex];WebInspector.InplaceEditor.startEditing(element,this._startEditingConfig(element));element.window().getSelection().setBaseAndExtent(element,0,element,1);},_startEditing:function(target)
  6371. {var element=target.enclosingNodeOrSelfWithNodeName("td");if(!element)
  6372. return;this._editingNode=this.dataGridNodeFromNode(target);if(!this._editingNode){if(!this.creationNode)
  6373. return;this._editingNode=this.creationNode;}
  6374. if(this._editingNode.isCreationNode)
  6375. return this._startEditingColumnOfDataGridNode(this._editingNode,this._nextEditableColumn(-1));this._editing=true;WebInspector.InplaceEditor.startEditing(element,this._startEditingConfig(element));element.window().getSelection().setBaseAndExtent(element,0,element,1);},renderInline:function()
  6376. {this.element.classList.add("inline");this._cornerWidth=0;this.updateWidths();},_startEditingConfig:function(element)
  6377. {return new WebInspector.InplaceEditor.Config(this._editingCommitted.bind(this),this._editingCancelled.bind(this),element.textContent);},_editingCommitted:function(element,newText,oldText,context,moveDirection)
  6378. {var columnIdentifier=this.columnIdentifierFromNode(element);if(!columnIdentifier){this._editingCancelled(element);return;}
  6379. var column=this._columns[columnIdentifier];var cellIndex=this._visibleColumnsArray.indexOf(column);var textBeforeEditing=this._editingNode.data[columnIdentifier];var currentEditingNode=this._editingNode;function moveToNextIfNeeded(wasChange){if(!moveDirection)
  6380. return;if(moveDirection==="forward"){var firstEditableColumn=this._nextEditableColumn(-1);if(currentEditingNode.isCreationNode&&cellIndex===firstEditableColumn&&!wasChange)
  6381. return;var nextEditableColumn=this._nextEditableColumn(cellIndex);if(nextEditableColumn!==-1)
  6382. return this._startEditingColumnOfDataGridNode(currentEditingNode,nextEditableColumn);var nextDataGridNode=currentEditingNode.traverseNextNode(true,null,true);if(nextDataGridNode)
  6383. return this._startEditingColumnOfDataGridNode(nextDataGridNode,firstEditableColumn);if(currentEditingNode.isCreationNode&&wasChange){this.addCreationNode(false);return this._startEditingColumnOfDataGridNode(this.creationNode,firstEditableColumn);}
  6384. return;}
  6385. if(moveDirection==="backward"){var prevEditableColumn=this._nextEditableColumn(cellIndex,true);if(prevEditableColumn!==-1)
  6386. return this._startEditingColumnOfDataGridNode(currentEditingNode,prevEditableColumn);var lastEditableColumn=this._nextEditableColumn(this._visibleColumnsArray.length,true);var nextDataGridNode=currentEditingNode.traversePreviousNode(true,true);if(nextDataGridNode)
  6387. return this._startEditingColumnOfDataGridNode(nextDataGridNode,lastEditableColumn);return;}}
  6388. if(textBeforeEditing==newText){this._editingCancelled(element);moveToNextIfNeeded.call(this,false);return;}
  6389. this._editingNode.data[columnIdentifier]=newText;this._editCallback(this._editingNode,columnIdentifier,textBeforeEditing,newText);if(this._editingNode.isCreationNode)
  6390. this.addCreationNode(false);this._editingCancelled(element);moveToNextIfNeeded.call(this,true);},_editingCancelled:function(element)
  6391. {this._editing=false;this._editingNode=null;},_nextEditableColumn:function(cellIndex,moveBackward)
  6392. {var increment=moveBackward?-1:1;var columns=this._visibleColumnsArray;for(var i=cellIndex+increment;(i>=0)&&(i<columns.length);i+=increment){if(columns[i].editable)
  6393. return i;}
  6394. return-1;},sortColumnIdentifier:function()
  6395. {if(!this._sortColumnCell)
  6396. return null;return this._sortColumnCell.columnIdentifier;},sortOrder:function()
  6397. {if(!this._sortColumnCell||this._sortColumnCell.classList.contains(WebInspector.DataGrid.Order.Ascending))
  6398. return WebInspector.DataGrid.Order.Ascending;if(this._sortColumnCell.classList.contains(WebInspector.DataGrid.Order.Descending))
  6399. return WebInspector.DataGrid.Order.Descending;return null;},isSortOrderAscending:function()
  6400. {return!this._sortColumnCell||this._sortColumnCell.classList.contains(WebInspector.DataGrid.Order.Ascending);},get headerTableBody()
  6401. {if("_headerTableBody"in this)
  6402. return this._headerTableBody;this._headerTableBody=this._headerTable.getElementsByTagName("tbody")[0];if(!this._headerTableBody){this._headerTableBody=this.element.ownerDocument.createElement("tbody");this._headerTable.insertBefore(this._headerTableBody,this._headerTable.tFoot);}
  6403. return this._headerTableBody;},get dataTableBody()
  6404. {if("_dataTableBody"in this)
  6405. return this._dataTableBody;this._dataTableBody=this._dataTable.getElementsByTagName("tbody")[0];if(!this._dataTableBody){this._dataTableBody=this.element.ownerDocument.createElement("tbody");this._dataTable.insertBefore(this._dataTableBody,this._dataTable.tFoot);}
  6406. return this._dataTableBody;},_autoSizeWidths:function(widths,minPercent,maxPercent)
  6407. {if(minPercent)
  6408. minPercent=Math.min(minPercent,Math.floor(100/widths.length));var totalWidth=0;for(var i=0;i<widths.length;++i)
  6409. totalWidth+=widths[i];var totalPercentWidth=0;for(var i=0;i<widths.length;++i){var width=Math.round(100*widths[i]/totalWidth);if(minPercent&&width<minPercent)
  6410. width=minPercent;else if(maxPercent&&width>maxPercent)
  6411. width=maxPercent;totalPercentWidth+=width;widths[i]=width;}
  6412. var recoupPercent=totalPercentWidth-100;while(minPercent&&recoupPercent>0){for(var i=0;i<widths.length;++i){if(widths[i]>minPercent){--widths[i];--recoupPercent;if(!recoupPercent)
  6413. break;}}}
  6414. while(maxPercent&&recoupPercent<0){for(var i=0;i<widths.length;++i){if(widths[i]<maxPercent){++widths[i];++recoupPercent;if(!recoupPercent)
  6415. break;}}}
  6416. return widths;},autoSizeColumns:function(minPercent,maxPercent,maxDescentLevel)
  6417. {var widths=[];for(var i=0;i<this._columnsArray.length;++i)
  6418. widths.push((this._columnsArray[i].title||"").length);maxDescentLevel=maxDescentLevel||0;var children=this._enumerateChildren(this._rootNode,[],maxDescentLevel+1);for(var i=0;i<children.length;++i){var node=children[i];for(var j=0;j<this._columnsArray.length;++j){var text=node.data[this._columnsArray[j].identifier]||"";if(text.length>widths[j])
  6419. widths[j]=text.length;}}
  6420. widths=this._autoSizeWidths(widths,minPercent,maxPercent);for(var i=0;i<this._columnsArray.length;++i)
  6421. this._columnsArray[i].weight=widths[i];this._columnWidthsInitialized=false;this.updateWidths();},_enumerateChildren:function(rootNode,result,maxLevel)
  6422. {if(!rootNode._isRoot)
  6423. result.push(rootNode);if(!maxLevel)
  6424. return;for(var i=0;i<rootNode.children.length;++i)
  6425. this._enumerateChildren(rootNode.children[i],result,maxLevel-1);return result;},onResize:function()
  6426. {this.updateWidths();},updateWidths:function()
  6427. {var headerTableColumns=this._headerTableColumnGroup.children;var tableWidth=this.element.offsetWidth-this._cornerWidth;var numColumns=headerTableColumns.length-1;if(!this._columnWidthsInitialized&&this.element.offsetWidth){for(var i=0;i<numColumns;i++){var columnWidth=this.headerTableBody.rows[0].cells[i].offsetWidth;var column=this._visibleColumnsArray[i];if(!column.weight)
  6428. column.weight=100*columnWidth/tableWidth;}
  6429. this._columnWidthsInitialized=true;}
  6430. this._applyColumnWeights();},setName:function(name)
  6431. {this._columnWeightsSetting=WebInspector.settings.createSetting("dataGrid-"+name+"-columnWeights",{});this._loadColumnWeights();},_loadColumnWeights:function()
  6432. {if(!this._columnWeightsSetting)
  6433. return;var weights=this._columnWeightsSetting.get();for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];var weight=weights[column.identifier];if(weight)
  6434. column.weight=weight;}
  6435. this._applyColumnWeights();},_saveColumnWeights:function()
  6436. {if(!this._columnWeightsSetting)
  6437. return;var weights={};for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];weights[column.identifier]=column.weight;}
  6438. this._columnWeightsSetting.set(weights);},wasShown:function()
  6439. {this._loadColumnWeights();},_applyColumnWeights:function()
  6440. {var tableWidth=this.element.offsetWidth-this._cornerWidth;if(tableWidth<=0)
  6441. return;var sumOfWeights=0.0;for(var i=0;i<this._visibleColumnsArray.length;++i)
  6442. sumOfWeights+=this._visibleColumnsArray[i].weight;var sum=0;var lastOffset=0;for(var i=0;i<this._visibleColumnsArray.length;++i){sum+=this._visibleColumnsArray[i].weight;var offset=(sum*tableWidth/sumOfWeights)|0;var width=(offset-lastOffset)+"px";this._headerTableColumnGroup.children[i].style.width=width;this._dataTableColumnGroup.children[i].style.width=width;lastOffset=offset;}
  6443. this._positionResizers();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},setColumnsVisiblity:function(columnsVisibility)
  6444. {this._visibleColumnsArray=[];for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];if(columnsVisibility[column.identifier])
  6445. this._visibleColumnsArray.push(column);}
  6446. this._refreshHeader();this._applyColumnWeights();var nodes=this._enumerateChildren(this.rootNode(),[],-1);for(var i=0;i<nodes.length;++i)
  6447. nodes[i].refresh();},get scrollContainer()
  6448. {return this._scrollContainer;},_positionResizers:function()
  6449. {var headerTableColumns=this._headerTableColumnGroup.children;var numColumns=headerTableColumns.length-1;var left=[];var resizers=this._resizers;while(resizers.length>numColumns-1)
  6450. resizers.pop().remove();for(var i=0;i<numColumns-1;i++){left[i]=(left[i-1]||0)+this.headerTableBody.rows[0].cells[i].offsetWidth;}
  6451. for(var i=0;i<numColumns-1;i++){var resizer=resizers[i];if(!resizer){resizer=createElement("div");resizer.__index=i;resizer.classList.add("data-grid-resizer");WebInspector.installDragHandle(resizer,this._startResizerDragging.bind(this),this._resizerDragging.bind(this),this._endResizerDragging.bind(this),"col-resize");this.element.appendChild(resizer);resizers.push(resizer);}
  6452. if(resizer.__position!==left[i]){resizer.__position=left[i];resizer.style.left=left[i]+"px";}}},addCreationNode:function(hasChildren)
  6453. {if(this.creationNode)
  6454. this.creationNode.makeNormal();var emptyData={};for(var column in this._columns)
  6455. emptyData[column]=null;this.creationNode=new WebInspector.CreationDataGridNode(emptyData,hasChildren);this.rootNode().appendChild(this.creationNode);},_keyDown:function(event)
  6456. {if(!this.selectedNode||event.shiftKey||event.metaKey||event.ctrlKey||this._editing)
  6457. return;var handled=false;var nextSelectedNode;if(event.keyIdentifier==="Up"&&!event.altKey){nextSelectedNode=this.selectedNode.traversePreviousNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
  6458. nextSelectedNode=nextSelectedNode.traversePreviousNode(true);handled=nextSelectedNode?true:false;}else if(event.keyIdentifier==="Down"&&!event.altKey){nextSelectedNode=this.selectedNode.traverseNextNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
  6459. nextSelectedNode=nextSelectedNode.traverseNextNode(true);handled=nextSelectedNode?true:false;}else if(event.keyIdentifier==="Left"){if(this.selectedNode.expanded){if(event.altKey)
  6460. this.selectedNode.collapseRecursively();else
  6461. this.selectedNode.collapse();handled=true;}else if(this.selectedNode.parent&&!this.selectedNode.parent._isRoot){handled=true;if(this.selectedNode.parent.selectable){nextSelectedNode=this.selectedNode.parent;handled=nextSelectedNode?true:false;}else if(this.selectedNode.parent)
  6462. this.selectedNode.parent.collapse();}}else if(event.keyIdentifier==="Right"){if(!this.selectedNode.revealed){this.selectedNode.reveal();handled=true;}else if(this.selectedNode.hasChildren){handled=true;if(this.selectedNode.expanded){nextSelectedNode=this.selectedNode.children[0];handled=nextSelectedNode?true:false;}else{if(event.altKey)
  6463. this.selectedNode.expandRecursively();else
  6464. this.selectedNode.expand();}}}else if(event.keyCode===8||event.keyCode===46){if(this._deleteCallback){handled=true;this._deleteCallback(this.selectedNode);this.changeNodeAfterDeletion();}}else if(isEnterKey(event)){if(this._editCallback){handled=true;this._startEditing(this.selectedNode._element.children[this._nextEditableColumn(-1)]);}}
  6465. if(nextSelectedNode){nextSelectedNode.reveal();nextSelectedNode.select();}
  6466. if(handled)
  6467. event.consume(true);},changeNodeAfterDeletion:function()
  6468. {var nextSelectedNode=this.selectedNode.traverseNextNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
  6469. nextSelectedNode=nextSelectedNode.traverseNextNode(true);if(!nextSelectedNode||nextSelectedNode.isCreationNode){nextSelectedNode=this.selectedNode.traversePreviousNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
  6470. nextSelectedNode=nextSelectedNode.traversePreviousNode(true);}
  6471. if(nextSelectedNode){nextSelectedNode.reveal();nextSelectedNode.select();}},dataGridNodeFromNode:function(target)
  6472. {var rowElement=target.enclosingNodeOrSelfWithNodeName("tr");return rowElement&&rowElement._dataGridNode;},columnIdentifierFromNode:function(target)
  6473. {var cellElement=target.enclosingNodeOrSelfWithNodeName("td");return cellElement&&cellElement.columnIdentifier_;},_clickInHeaderCell:function(event)
  6474. {var cell=event.target.enclosingNodeOrSelfWithNodeName("th");if(!cell||(cell.columnIdentifier===undefined)||!cell.classList.contains("sortable"))
  6475. return;var sortOrder=WebInspector.DataGrid.Order.Ascending;if((cell===this._sortColumnCell)&&this.isSortOrderAscending())
  6476. sortOrder=WebInspector.DataGrid.Order.Descending;if(this._sortColumnCell)
  6477. this._sortColumnCell.classList.remove(WebInspector.DataGrid.Order.Ascending,WebInspector.DataGrid.Order.Descending);this._sortColumnCell=cell;cell.classList.add(sortOrder);this.dispatchEventToListeners(WebInspector.DataGrid.Events.SortingChanged);},markColumnAsSortedBy:function(columnIdentifier,sortOrder)
  6478. {if(this._sortColumnCell)
  6479. this._sortColumnCell.classList.remove(WebInspector.DataGrid.Order.Ascending,WebInspector.DataGrid.Order.Descending);this._sortColumnCell=this._headerTableHeaders[columnIdentifier];this._sortColumnCell.classList.add(sortOrder);},headerTableHeader:function(columnIdentifier)
  6480. {return this._headerTableHeaders[columnIdentifier];},_mouseDownInDataTable:function(event)
  6481. {var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.selectable)
  6482. return;if(gridNode.isEventWithinDisclosureTriangle(event))
  6483. return;if(event.metaKey){if(gridNode.selected)
  6484. gridNode.deselect();else
  6485. gridNode.select();}else
  6486. gridNode.select();},_contextMenuInDataTable:function(event)
  6487. {var contextMenu=new WebInspector.ContextMenu(event);var gridNode=this.dataGridNodeFromNode(event.target);if(this._refreshCallback&&(!gridNode||gridNode!==this.creationNode))
  6488. contextMenu.appendItem(WebInspector.UIString("Refresh"),this._refreshCallback.bind(this));if(gridNode&&gridNode.selectable&&!gridNode.isEventWithinDisclosureTriangle(event)){if(this._editCallback){if(gridNode===this.creationNode)
  6489. contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^new"),this._startEditing.bind(this,event.target));else{var columnIdentifier=this.columnIdentifierFromNode(event.target);if(columnIdentifier&&this._columns[columnIdentifier].editable)
  6490. contextMenu.appendItem(WebInspector.UIString("Edit \"%s\"",this._columns[columnIdentifier].title),this._startEditing.bind(this,event.target));}}
  6491. if(this._deleteCallback&&gridNode!==this.creationNode)
  6492. contextMenu.appendItem(WebInspector.UIString.capitalize("Delete"),this._deleteCallback.bind(this,gridNode));if(this._contextMenuCallback)
  6493. this._contextMenuCallback(contextMenu,gridNode);}
  6494. contextMenu.show();},_clickInDataTable:function(event)
  6495. {var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.hasChildren)
  6496. return;if(!gridNode.isEventWithinDisclosureTriangle(event))
  6497. return;if(gridNode.expanded){if(event.altKey)
  6498. gridNode.collapseRecursively();else
  6499. gridNode.collapse();}else{if(event.altKey)
  6500. gridNode.expandRecursively();else
  6501. gridNode.expand();}},setResizeMethod:function(method)
  6502. {this._resizeMethod=method;},_startResizerDragging:function(event)
  6503. {this._currentResizer=event.target;return true;},_resizerDragging:function(event)
  6504. {var resizer=this._currentResizer;if(!resizer)
  6505. return;var dragPoint=event.clientX-this.element.totalOffsetLeft();var firstRowCells=this.headerTableBody.rows[0].cells;var leftEdgeOfPreviousColumn=0;var leftCellIndex=resizer.__index;var rightCellIndex=leftCellIndex+1;for(var i=0;i<leftCellIndex;i++)
  6506. leftEdgeOfPreviousColumn+=firstRowCells[i].offsetWidth;if(this._resizeMethod===WebInspector.DataGrid.ResizeMethod.Last){rightCellIndex=this._resizers.length;}else if(this._resizeMethod===WebInspector.DataGrid.ResizeMethod.First){leftEdgeOfPreviousColumn+=firstRowCells[leftCellIndex].offsetWidth-firstRowCells[0].offsetWidth;leftCellIndex=0;}
  6507. var rightEdgeOfNextColumn=leftEdgeOfPreviousColumn+firstRowCells[leftCellIndex].offsetWidth+firstRowCells[rightCellIndex].offsetWidth;var leftMinimum=leftEdgeOfPreviousColumn+this.ColumnResizePadding;var rightMaximum=rightEdgeOfNextColumn-this.ColumnResizePadding;if(leftMinimum>rightMaximum)
  6508. return;dragPoint=Number.constrain(dragPoint,leftMinimum,rightMaximum);var position=(dragPoint-this.CenterResizerOverBorderAdjustment);resizer.__position=position;resizer.style.left=position+"px";var pxLeftColumn=(dragPoint-leftEdgeOfPreviousColumn)+"px";this._headerTableColumnGroup.children[leftCellIndex].style.width=pxLeftColumn;this._dataTableColumnGroup.children[leftCellIndex].style.width=pxLeftColumn;var pxRightColumn=(rightEdgeOfNextColumn-dragPoint)+"px";this._headerTableColumnGroup.children[rightCellIndex].style.width=pxRightColumn;this._dataTableColumnGroup.children[rightCellIndex].style.width=pxRightColumn;var leftColumn=this._visibleColumnsArray[leftCellIndex];var rightColumn=this._visibleColumnsArray[rightCellIndex];if(leftColumn.weight||rightColumn.weight){var sumOfWeights=leftColumn.weight+rightColumn.weight;var delta=rightEdgeOfNextColumn-leftEdgeOfPreviousColumn;leftColumn.weight=(dragPoint-leftEdgeOfPreviousColumn)*sumOfWeights/delta;rightColumn.weight=(rightEdgeOfNextColumn-dragPoint)*sumOfWeights/delta;}
  6509. this._positionResizers();event.preventDefault();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},columnOffset:function(columnId)
  6510. {if(!this.element.offsetWidth)
  6511. return 0;for(var i=1;i<this._visibleColumnsArray.length;++i){if(columnId===this._visibleColumnsArray[i].identifier){if(this._resizers[i-1])
  6512. return this._resizers[i-1].__position;}}
  6513. return 0;},_endResizerDragging:function(event)
  6514. {this._currentResizer=null;this._saveColumnWeights();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},ColumnResizePadding:24,CenterResizerOverBorderAdjustment:3,__proto__:WebInspector.View.prototype}
  6515. WebInspector.DataGrid.ResizeMethod={Nearest:"nearest",First:"first",Last:"last"}
  6516. WebInspector.DataGridNode=function(data,hasChildren)
  6517. {this._element=null;this._expanded=false;this._selected=false;this._depth;this._revealed;this._attached=false;this._savedPosition=null;this._shouldRefreshChildren=true;this._data=data||{};this.hasChildren=hasChildren||false;this.children=[];this.dataGrid=null;this.parent=null;this.previousSibling=null;this.nextSibling=null;this.disclosureToggleWidth=10;}
  6518. WebInspector.DataGridNode.prototype={selectable:true,_isRoot:false,element:function()
  6519. {if(!this._element){this.createElement();this.createCells();}
  6520. return(this._element);},createElement:function()
  6521. {this._element=createElement("tr");this._element._dataGridNode=this;if(this.hasChildren)
  6522. this._element.classList.add("parent");if(this.expanded)
  6523. this._element.classList.add("expanded");if(this.selected)
  6524. this._element.classList.add("selected");if(this.revealed)
  6525. this._element.classList.add("revealed");},createCells:function()
  6526. {this._element.removeChildren();var columnsArray=this.dataGrid._visibleColumnsArray;for(var i=0;i<columnsArray.length;++i)
  6527. this._element.appendChild(this.createCell(columnsArray[i].identifier));this._element.appendChild(this._createTDWithClass("corner"));},get data()
  6528. {return this._data;},set data(x)
  6529. {this._data=x||{};this.refresh();},get revealed()
  6530. {if(this._revealed!==undefined)
  6531. return this._revealed;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor._isRoot){if(!currentAncestor.expanded){this._revealed=false;return false;}
  6532. currentAncestor=currentAncestor.parent;}
  6533. this._revealed=true;return true;},set hasChildren(x)
  6534. {if(this._hasChildren===x)
  6535. return;this._hasChildren=x;if(!this._element)
  6536. return;this._element.classList.toggle("parent",this._hasChildren);this._element.classList.toggle("expanded",this._hasChildren&&this.expanded);},get hasChildren()
  6537. {return this._hasChildren;},set revealed(x)
  6538. {if(this._revealed===x)
  6539. return;this._revealed=x;if(this._element)
  6540. this._element.classList.toggle("revealed",this._revealed);for(var i=0;i<this.children.length;++i)
  6541. this.children[i].revealed=x&&this.expanded;},get depth()
  6542. {if(this._depth!==undefined)
  6543. return this._depth;if(this.parent&&!this.parent._isRoot)
  6544. this._depth=this.parent.depth+1;else
  6545. this._depth=0;return this._depth;},get leftPadding()
  6546. {if(typeof this._leftPadding==="number")
  6547. return this._leftPadding;this._leftPadding=this.depth*this.dataGrid.indentWidth;return this._leftPadding;},get shouldRefreshChildren()
  6548. {return this._shouldRefreshChildren;},set shouldRefreshChildren(x)
  6549. {this._shouldRefreshChildren=x;if(x&&this.expanded)
  6550. this.expand();},get selected()
  6551. {return this._selected;},set selected(x)
  6552. {if(x)
  6553. this.select();else
  6554. this.deselect();},get expanded()
  6555. {return this._expanded;},set expanded(x)
  6556. {if(x)
  6557. this.expand();else
  6558. this.collapse();},refresh:function()
  6559. {if(!this.dataGrid)
  6560. this._element=null;if(!this._element)
  6561. return;this.createCells();},_createTDWithClass:function(className)
  6562. {var cell=createElementWithClass("td",className);var cellClass=this.dataGrid._cellClass;if(cellClass)
  6563. cell.classList.add(cellClass);return cell;},createTD:function(columnIdentifier)
  6564. {var cell=this._createTDWithClass(columnIdentifier+"-column");cell.columnIdentifier_=columnIdentifier;var alignment=this.dataGrid._columns[columnIdentifier].align;if(alignment)
  6565. cell.classList.add(alignment);return cell;},createCell:function(columnIdentifier)
  6566. {var cell=this.createTD(columnIdentifier);var data=this.data[columnIdentifier];if(data instanceof Node){cell.appendChild(data);}else{cell.textContent=data;if(this.dataGrid._columns[columnIdentifier].longText)
  6567. cell.title=data;}
  6568. if(columnIdentifier===this.dataGrid.disclosureColumnIdentifier){cell.classList.add("disclosure");if(this.leftPadding)
  6569. cell.style.setProperty("padding-left",this.leftPadding+"px");}
  6570. return cell;},nodeSelfHeight:function()
  6571. {return 16;},appendChild:function(child)
  6572. {this.insertChild(child,this.children.length);},insertChild:function(child,index)
  6573. {if(!child)
  6574. throw("insertChild: Node can't be undefined or null.");if(child.parent===this)
  6575. throw("insertChild: Node is already a child of this node.");child.remove();this.children.splice(index,0,child);this.hasChildren=true;child.parent=this;child.dataGrid=this.dataGrid;child.recalculateSiblings(index);child._depth=undefined;child._revealed=undefined;child._attached=false;child._shouldRefreshChildren=true;var current=child.children[0];while(current){current.dataGrid=this.dataGrid;current._depth=undefined;current._revealed=undefined;current._attached=false;current._shouldRefreshChildren=true;current=current.traverseNextNode(false,child,true);}
  6576. if(this.expanded)
  6577. child._attach();if(!this.revealed)
  6578. child.revealed=false;},remove:function()
  6579. {if(this.parent)
  6580. this.parent.removeChild(this);},removeChild:function(child)
  6581. {if(!child)
  6582. throw("removeChild: Node can't be undefined or null.");if(child.parent!==this)
  6583. throw("removeChild: Node is not a child of this node.");child.deselect();child._detach();this.children.remove(child,true);if(child.previousSibling)
  6584. child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
  6585. child.nextSibling.previousSibling=child.previousSibling;child.dataGrid=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(this.children.length<=0)
  6586. this.hasChildren=false;},removeChildren:function()
  6587. {for(var i=0;i<this.children.length;++i){var child=this.children[i];child.deselect();child._detach();child.dataGrid=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
  6588. this.children=[];this.hasChildren=false;},recalculateSiblings:function(myIndex)
  6589. {if(!this.parent)
  6590. return;var previousChild=this.parent.children[myIndex-1]||null;if(previousChild)
  6591. previousChild.nextSibling=this;this.previousSibling=previousChild;var nextChild=this.parent.children[myIndex+1]||null;if(nextChild)
  6592. nextChild.previousSibling=this;this.nextSibling=nextChild;},collapse:function()
  6593. {if(this._isRoot)
  6594. return;if(this._element)
  6595. this._element.classList.remove("expanded");this._expanded=false;for(var i=0;i<this.children.length;++i)
  6596. this.children[i].revealed=false;},collapseRecursively:function()
  6597. {var item=this;while(item){if(item.expanded)
  6598. item.collapse();item=item.traverseNextNode(false,this,true);}},populate:function(){},expand:function()
  6599. {if(!this.hasChildren||this.expanded)
  6600. return;if(this._isRoot)
  6601. return;if(this.revealed&&!this._shouldRefreshChildren)
  6602. for(var i=0;i<this.children.length;++i)
  6603. this.children[i].revealed=true;if(this._shouldRefreshChildren){for(var i=0;i<this.children.length;++i)
  6604. this.children[i]._detach();this.populate();if(this._attached){for(var i=0;i<this.children.length;++i){var child=this.children[i];if(this.revealed)
  6605. child.revealed=true;child._attach();}}
  6606. this._shouldRefreshChildren=false;}
  6607. if(this._element)
  6608. this._element.classList.add("expanded");this._expanded=true;},expandRecursively:function()
  6609. {var item=this;while(item){item.expand();item=item.traverseNextNode(false,this);}},reveal:function()
  6610. {if(this._isRoot)
  6611. return;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor._isRoot){if(!currentAncestor.expanded)
  6612. currentAncestor.expand();currentAncestor=currentAncestor.parent;}
  6613. this.element().scrollIntoViewIfNeeded(false);},select:function(supressSelectedEvent)
  6614. {if(!this.dataGrid||!this.selectable||this.selected)
  6615. return;if(this.dataGrid.selectedNode)
  6616. this.dataGrid.selectedNode.deselect();this._selected=true;this.dataGrid.selectedNode=this;if(this._element)
  6617. this._element.classList.add("selected");if(!supressSelectedEvent)
  6618. this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.SelectedNode);},revealAndSelect:function()
  6619. {if(this._isRoot)
  6620. return;this.reveal();this.select();},deselect:function(supressDeselectedEvent)
  6621. {if(!this.dataGrid||this.dataGrid.selectedNode!==this||!this.selected)
  6622. return;this._selected=false;this.dataGrid.selectedNode=null;if(this._element)
  6623. this._element.classList.remove("selected");if(!supressDeselectedEvent)
  6624. this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.DeselectedNode);},traverseNextNode:function(skipHidden,stayWithin,dontPopulate,info)
  6625. {if(!dontPopulate&&this.hasChildren)
  6626. this.populate();if(info)
  6627. info.depthChange=0;var node=(!skipHidden||this.revealed)?this.children[0]:null;if(node&&(!skipHidden||this.expanded)){if(info)
  6628. info.depthChange=1;return node;}
  6629. if(this===stayWithin)
  6630. return null;node=(!skipHidden||this.revealed)?this.nextSibling:null;if(node)
  6631. return node;node=this;while(node&&!node._isRoot&&!((!skipHidden||node.revealed)?node.nextSibling:null)&&node.parent!==stayWithin){if(info)
  6632. info.depthChange-=1;node=node.parent;}
  6633. if(!node)
  6634. return null;return(!skipHidden||node.revealed)?node.nextSibling:null;},traversePreviousNode:function(skipHidden,dontPopulate)
  6635. {var node=(!skipHidden||this.revealed)?this.previousSibling:null;if(!dontPopulate&&node&&node.hasChildren)
  6636. node.populate();while(node&&((!skipHidden||(node.revealed&&node.expanded))?node.children[node.children.length-1]:null)){if(!dontPopulate&&node.hasChildren)
  6637. node.populate();node=((!skipHidden||(node.revealed&&node.expanded))?node.children[node.children.length-1]:null);}
  6638. if(node)
  6639. return node;if(!this.parent||this.parent._isRoot)
  6640. return null;return this.parent;},isEventWithinDisclosureTriangle:function(event)
  6641. {if(!this.hasChildren)
  6642. return false;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell.classList.contains("disclosure"))
  6643. return false;var left=cell.totalOffsetLeft()+this.leftPadding;return event.pageX>=left&&event.pageX<=left+this.disclosureToggleWidth;},_attach:function()
  6644. {if(!this.dataGrid||this._attached)
  6645. return;this._attached=true;var previousNode=this.traversePreviousNode(true,true);var previousElement=previousNode?previousNode.element():this.dataGrid._topFillerRow;this.dataGrid.dataTableBody.insertBefore(this.element(),previousElement.nextSibling);if(this.expanded)
  6646. for(var i=0;i<this.children.length;++i)
  6647. this.children[i]._attach();},_detach:function()
  6648. {if(!this._attached)
  6649. return;this._attached=false;if(this._element)
  6650. this._element.remove();for(var i=0;i<this.children.length;++i)
  6651. this.children[i]._detach();this.wasDetached();},wasDetached:function()
  6652. {},savePosition:function()
  6653. {if(this._savedPosition)
  6654. return;if(!this.parent)
  6655. throw("savePosition: Node must have a parent.");this._savedPosition={parent:this.parent,index:this.parent.children.indexOf(this)};},restorePosition:function()
  6656. {if(!this._savedPosition)
  6657. return;if(this.parent!==this._savedPosition.parent)
  6658. this._savedPosition.parent.insertChild(this,this._savedPosition.index);this._savedPosition=null;},__proto__:WebInspector.Object.prototype}
  6659. WebInspector.CreationDataGridNode=function(data,hasChildren)
  6660. {WebInspector.DataGridNode.call(this,data,hasChildren);this.isCreationNode=true;}
  6661. WebInspector.CreationDataGridNode.prototype={makeNormal:function()
  6662. {this.isCreationNode=false;},__proto__:WebInspector.DataGridNode.prototype};WebInspector.Dialog=function(relativeToElement,delegate)
  6663. {this._delegate=delegate;this._relativeToElement=relativeToElement;this._glassPane=new WebInspector.GlassPane((relativeToElement.ownerDocument));WebInspector.GlassPane.DefaultFocusedViewStack.push(this);this._glassPane.element.tabIndex=0;this._glassPane.element.addEventListener("focus",this._onGlassPaneFocus.bind(this),false);this._element=this._glassPane.element.createChild("div");this._element.tabIndex=0;this._element.addEventListener("focus",this._onFocus.bind(this),false);this._element.addEventListener("keydown",this._onKeyDown.bind(this),false);this._closeKeys=[WebInspector.KeyboardShortcut.Keys.Enter.code,WebInspector.KeyboardShortcut.Keys.Esc.code,];delegate.show(this._element);this._position();this._delegate.focus();}
  6664. WebInspector.Dialog.currentInstance=function()
  6665. {return WebInspector.Dialog._instance;}
  6666. WebInspector.Dialog.show=function(relativeToElement,delegate)
  6667. {if(WebInspector.Dialog._instance)
  6668. return;WebInspector.Dialog._instance=new WebInspector.Dialog(relativeToElement,delegate);}
  6669. WebInspector.Dialog.hide=function()
  6670. {if(!WebInspector.Dialog._instance)
  6671. return;WebInspector.Dialog._instance._hide();}
  6672. WebInspector.Dialog.prototype={focus:function()
  6673. {this._element.focus();},_hide:function()
  6674. {if(this._isHiding)
  6675. return;this._isHiding=true;this._delegate.willHide();delete WebInspector.Dialog._instance;WebInspector.GlassPane.DefaultFocusedViewStack.pop();this._glassPane.dispose();},_onGlassPaneFocus:function(event)
  6676. {this._hide();},_onFocus:function(event)
  6677. {this._delegate.focus();},_position:function()
  6678. {this._delegate.position(this._element,this._relativeToElement);},_onKeyDown:function(event)
  6679. {if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Tab.code){event.preventDefault();return;}
  6680. if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Enter.code)
  6681. this._delegate.onEnter(event);if(!event.handled&&this._closeKeys.indexOf(event.keyCode)>=0){this._hide();event.consume(true);}}};WebInspector.DialogDelegate=function()
  6682. {this.element;}
  6683. WebInspector.DialogDelegate.prototype={show:function(element)
  6684. {element.appendChild(this.element);this.element.classList.add("dialog-contents");element.classList.add("dialog");},position:function(element,relativeToElement)
  6685. {var container=WebInspector.Dialog._modalHostView.element;var box=relativeToElement.boxInWindow(window).relativeToElement(container);var positionX=box.x+(relativeToElement.offsetWidth-element.offsetWidth)/2;positionX=Number.constrain(positionX,0,container.offsetWidth-element.offsetWidth);var positionY=box.y+(relativeToElement.offsetHeight-element.offsetHeight)/2;positionY=Number.constrain(positionY,0,container.offsetHeight-element.offsetHeight);element.style.position="absolute";element.positionAt(positionX,positionY,container);},focus:function(){},onEnter:function(event){},willHide:function(){},__proto__:WebInspector.Object.prototype}
  6686. WebInspector.Dialog._modalHostView=null;WebInspector.Dialog.setModalHostView=function(view)
  6687. {WebInspector.Dialog._modalHostView=view;};WebInspector.Dialog.modalHostView=function()
  6688. {return WebInspector.Dialog._modalHostView;};WebInspector.Dialog.modalHostRepositioned=function()
  6689. {if(WebInspector.Dialog._instance)
  6690. WebInspector.Dialog._instance._position();};;WebInspector.DOMSyntaxHighlighter=function(mimeType,stripExtraWhitespace)
  6691. {this._mimeType=mimeType;this._stripExtraWhitespace=stripExtraWhitespace;}
  6692. WebInspector.DOMSyntaxHighlighter.prototype={createSpan:function(content,className)
  6693. {var span=createElement("span");span.className="cm-"+className;if(this._stripExtraWhitespace&&className!=="whitespace")
  6694. content=content.replace(/^[\n\r]*/,"").replace(/\s*$/,"");span.createTextChild(content);return span;},syntaxHighlightNode:function(node)
  6695. {var lines=node.textContent.split("\n");var plainTextStart;var line;return self.runtime.instancePromise(WebInspector.TokenizerFactory).then(processTokens.bind(this));function processTokens(tokenizerFactory)
  6696. {node.removeChildren();var tokenize=tokenizerFactory.createTokenizer(this._mimeType);for(var i=lines[0].length?0:1;i<lines.length;++i){line=lines[i];plainTextStart=0;tokenize(line,processToken.bind(this));if(plainTextStart<line.length){var plainText=line.substring(plainTextStart,line.length);node.createTextChild(plainText);}
  6697. if(i<lines.length-1)
  6698. node.createChild("br");}}
  6699. function processToken(token,tokenType,column,newColumn)
  6700. {if(!tokenType)
  6701. return;if(column>plainTextStart){var plainText=line.substring(plainTextStart,column);node.createTextChild(plainText);}
  6702. node.appendChild(this.createSpan(token,tokenType));plainTextStart=newColumn;}}};WebInspector.DropDownMenu=function(element)
  6703. {this._items=[];element.addEventListener("mousedown",this._onMouseDown.bind(this));}
  6704. WebInspector.DropDownMenu.Item;WebInspector.DropDownMenu.Events={ItemSelected:"ItemSelected"}
  6705. WebInspector.DropDownMenu.prototype={_onMouseDown:function(event)
  6706. {var menu=new WebInspector.ContextMenu(event);for(var item of this._items)
  6707. menu.appendCheckboxItem(item.title,this._itemHandler.bind(this,item.id),item.id===this._selectedItemId);menu.show();},_itemHandler:function(id)
  6708. {this.dispatchEventToListeners(WebInspector.DropDownMenu.Events.ItemSelected,id);},addItem:function(id,title)
  6709. {this._items.push({id:id,title:title});},selectItem:function(id)
  6710. {this._selectedItemId=id;},clear:function()
  6711. {this._items=[];delete this._selectedItemId;},__proto__:WebInspector.Object.prototype};WebInspector.EmptyView=function(text)
  6712. {WebInspector.VBox.call(this);this._text=text;}
  6713. WebInspector.EmptyView.prototype={wasShown:function()
  6714. {this.element.classList.add("empty-view");this.element.textContent=this._text;},set text(text)
  6715. {this._text=text;if(this.isShowing())
  6716. this.element.textContent=this._text;},__proto__:WebInspector.VBox.prototype};WebInspector.FilterBar=function()
  6717. {this._filtersShown=false;this._element=createElementWithClass("div","filter-bar hbox");this._filterButton=new WebInspector.StatusBarButton(WebInspector.UIString("Filter"),"filter-status-bar-item",3);this._filterButton.element.addEventListener("click",this._handleFilterButtonClick.bind(this),false);this._filters=[];}
  6718. WebInspector.FilterBar.Events={FiltersToggled:"FiltersToggled"}
  6719. WebInspector.FilterBar.FilterBarState={Inactive:"inactive",Active:"active",Shown:"shown"};WebInspector.FilterBar.prototype={setName:function(name)
  6720. {this._stateSetting=WebInspector.settings.createSetting("filterBar-"+name+"-toggled",false);this._setState(this._stateSetting.get());},filterButton:function()
  6721. {return this._filterButton;},filtersElement:function()
  6722. {return this._element;},filtersToggled:function()
  6723. {return this._filtersShown;},addFilter:function(filter)
  6724. {this._filters.push(filter);this._element.appendChild(filter.element());filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._filterChanged,this);this._updateFilterButton();},_filterChanged:function(event)
  6725. {this._updateFilterButton();},_filterBarState:function()
  6726. {if(this._filtersShown)
  6727. return WebInspector.FilterBar.FilterBarState.Shown;var isActive=false;for(var i=0;i<this._filters.length;++i){if(this._filters[i].isActive())
  6728. return WebInspector.FilterBar.FilterBarState.Active;}
  6729. return WebInspector.FilterBar.FilterBarState.Inactive;},_updateFilterButton:function()
  6730. {this._filterButton.setState(this._filterBarState());},_handleFilterButtonClick:function(event)
  6731. {this._setState(!this._filtersShown);},_setState:function(filtersShown)
  6732. {if(this._filtersShown===filtersShown)
  6733. return;this._filtersShown=filtersShown;if(this._stateSetting)
  6734. this._stateSetting.set(filtersShown);this._updateFilterButton();this.dispatchEventToListeners(WebInspector.FilterBar.Events.FiltersToggled,this._filtersShown);if(this._filtersShown){for(var i=0;i<this._filters.length;++i){if(this._filters[i]instanceof WebInspector.TextFilterUI){var textFilterUI=(this._filters[i]);textFilterUI.focus();}}}},clear:function()
  6735. {this._element.removeChildren();this._filters=[];this._updateFilterButton();},__proto__:WebInspector.Object.prototype}
  6736. WebInspector.FilterUI=function()
  6737. {}
  6738. WebInspector.FilterUI.Events={FilterChanged:"FilterChanged"}
  6739. WebInspector.FilterUI.prototype={isActive:function(){},element:function(){}}
  6740. WebInspector.TextFilterUI=function(supportRegex)
  6741. {this._supportRegex=!!supportRegex;this._regex=null;this._filterElement=createElement("div");this._filterElement.className="filter-text-filter";this._filterInputElement=(this._filterElement.createChild("input","filter-input-field"));this._filterInputElement.placeholder=WebInspector.UIString("Filter");this._filterInputElement.id="filter-input-field";this._filterInputElement.addEventListener("mousedown",this._onFilterFieldManualFocus.bind(this),false);this._filterInputElement.addEventListener("input",this._onInput.bind(this),false);this._filterInputElement.addEventListener("change",this._onChange.bind(this),false);this._filterInputElement.addEventListener("keydown",this._onInputKeyDown.bind(this),true);this._filterInputElement.addEventListener("blur",this._onBlur.bind(this),true);this._suggestionBuilder=null;this._suggestBox=new WebInspector.SuggestBox(this);if(this._supportRegex){this._filterElement.classList.add("supports-regex");var label=createCheckboxLabel(WebInspector.UIString("Regex"));this._regexCheckBox=label.checkboxElement;this._regexCheckBox.id="text-filter-regex";this._regexCheckBox.addEventListener("change",this._onInput.bind(this),false);this._filterElement.appendChild(label);this._regexLabel=this._filterElement.textElement;}}
  6742. WebInspector.TextFilterUI.prototype={isActive:function()
  6743. {return!!this._filterInputElement.value;},element:function()
  6744. {return this._filterElement;},value:function()
  6745. {return this._filterInputElement.value;},setValue:function(value)
  6746. {this._filterInputElement.value=value;this._valueChanged(false);},regex:function()
  6747. {return this._regex;},_onFilterFieldManualFocus:function(event)
  6748. {WebInspector.setCurrentFocusElement((event.target));},_onBlur:function(event)
  6749. {this._cancelSuggestion();},_cancelSuggestion:function()
  6750. {if(this._suggestionBuilder&&this._suggestBox.visible){this._suggestionBuilder.unapplySuggestion(this._filterInputElement);this._suggestBox.hide();}},_onInput:function()
  6751. {this._valueChanged(true);},_onChange:function()
  6752. {this._valueChanged(false);},focus:function()
  6753. {this._filterInputElement.focus();},setSuggestionBuilder:function(suggestionBuilder)
  6754. {this._cancelSuggestion();this._suggestionBuilder=suggestionBuilder;},_updateSuggestions:function()
  6755. {if(!this._suggestionBuilder)
  6756. return;var suggestions=this._suggestionBuilder.buildSuggestions(this._filterInputElement);if(suggestions&&suggestions.length){if(this._suppressSuggestion)
  6757. delete this._suppressSuggestion;else
  6758. this._suggestionBuilder.applySuggestion(this._filterInputElement,suggestions[0],true);var anchorBox=this._filterInputElement.boxInWindow().relativeTo(new AnchorBox(-3,0));this._suggestBox.updateSuggestions(anchorBox,suggestions,0,true,"");}else{this._suggestBox.hide();}},_valueChanged:function(showSuggestions)
  6759. {if(showSuggestions)
  6760. this._updateSuggestions();else
  6761. this._suggestBox.hide();var filterQuery=this.value();this._regex=null;this._filterInputElement.classList.remove("filter-text-invalid");if(filterQuery){if(this._supportRegex&&this._regexCheckBox.checked){try{this._regex=new RegExp(filterQuery,"i");}catch(e){this._filterInputElement.classList.add("filter-text-invalid");}}else{this._regex=createPlainTextSearchRegex(filterQuery,"i");}}
  6762. this._dispatchFilterChanged();},_dispatchFilterChanged:function()
  6763. {this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},_onInputKeyDown:function(event)
  6764. {var handled=false;if(event.keyIdentifier==="U+0008"){this._suppressSuggestion=true;}else if(this._suggestBox.visible()){if(event.keyIdentifier==="U+001B"){this._cancelSuggestion();handled=true;}else if(event.keyIdentifier==="U+0009"){this._suggestBox.acceptSuggestion();this._valueChanged(true);handled=true;}else{handled=this._suggestBox.keyPressed((event));}}
  6765. if(handled)
  6766. event.consume(true);return handled;},applySuggestion:function(suggestion,isIntermediateSuggestion)
  6767. {if(!this._suggestionBuilder)
  6768. return;this._suggestionBuilder.applySuggestion(this._filterInputElement,suggestion,!!isIntermediateSuggestion);if(isIntermediateSuggestion)
  6769. this._dispatchFilterChanged();},acceptSuggestion:function()
  6770. {this._filterInputElement.scrollLeft=this._filterInputElement.scrollWidth;this._valueChanged(true);},__proto__:WebInspector.Object.prototype}
  6771. WebInspector.TextFilterUI.SuggestionBuilder=function()
  6772. {}
  6773. WebInspector.TextFilterUI.SuggestionBuilder.prototype={buildSuggestions:function(input){},applySuggestion:function(input,suggestion,isIntermediate){},unapplySuggestion:function(input){}}
  6774. WebInspector.NamedBitSetFilterUI=function(items,setting)
  6775. {this._filtersElement=createElementWithClass("div","filter-bitset-filter");this._filtersElement.title=WebInspector.UIString("Use %s Click to select multiple types.",WebInspector.KeyboardShortcut.shortcutToString("",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta));this._allowedTypes={};this._typeFilterElements={};this._addBit(WebInspector.NamedBitSetFilterUI.ALL_TYPES,WebInspector.UIString("All"));this._filtersElement.createChild("div","filter-bitset-filter-divider");for(var i=0;i<items.length;++i)
  6776. this._addBit(items[i].name,items[i].label);if(setting){this._setting=setting;setting.addChangeListener(this._settingChanged.bind(this));this._settingChanged();}else{this._toggleTypeFilter(WebInspector.NamedBitSetFilterUI.ALL_TYPES,false);}}
  6777. WebInspector.NamedBitSetFilterUI.Item;WebInspector.NamedBitSetFilterUI.ALL_TYPES="all";WebInspector.NamedBitSetFilterUI.prototype={isActive:function()
  6778. {return!this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES];},element:function()
  6779. {return this._filtersElement;},accept:function(typeName)
  6780. {return!!this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]||!!this._allowedTypes[typeName];},_settingChanged:function()
  6781. {var allowedTypes=this._setting.get();this._allowedTypes={};for(var typeName in this._typeFilterElements){if(allowedTypes[typeName])
  6782. this._allowedTypes[typeName]=true;}
  6783. this._update();},_update:function()
  6784. {if((Object.keys(this._allowedTypes).length===0)||this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]){this._allowedTypes={};this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]=true;}
  6785. for(var typeName in this._typeFilterElements)
  6786. this._typeFilterElements[typeName].classList.toggle("selected",this._allowedTypes[typeName]);this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},_addBit:function(name,label)
  6787. {var typeFilterElement=this._filtersElement.createChild("li",name);typeFilterElement.typeName=name;typeFilterElement.createTextChild(label);typeFilterElement.addEventListener("click",this._onTypeFilterClicked.bind(this),false);this._typeFilterElements[name]=typeFilterElement;},_onTypeFilterClicked:function(e)
  6788. {var toggle;if(WebInspector.isMac())
  6789. toggle=e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey;else
  6790. toggle=e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey;this._toggleTypeFilter(e.target.typeName,toggle);},_toggleTypeFilter:function(typeName,allowMultiSelect)
  6791. {if(allowMultiSelect&&typeName!==WebInspector.NamedBitSetFilterUI.ALL_TYPES)
  6792. this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]=false;else
  6793. this._allowedTypes={};this._allowedTypes[typeName]=!this._allowedTypes[typeName];if(this._setting)
  6794. this._setting.set(this._allowedTypes);else
  6795. this._update();},__proto__:WebInspector.Object.prototype}
  6796. WebInspector.ComboBoxFilterUI=function(options)
  6797. {this._filterElement=createElement("div");this._filterElement.className="filter-combobox-filter";this._options=options;this._filterComboBox=new WebInspector.StatusBarComboBox(this._filterChanged.bind(this));for(var i=0;i<options.length;++i){var filterOption=options[i];var option=createElement("option");option.text=filterOption.label;option.title=filterOption.title;this._filterComboBox.addOption(option);this._filterComboBox.element.title=this._filterComboBox.selectedOption().title;}
  6798. this._filterElement.appendChild(this._filterComboBox.element);}
  6799. WebInspector.ComboBoxFilterUI.prototype={isActive:function()
  6800. {return this._filterComboBox.selectedIndex()!==0;},element:function()
  6801. {return this._filterElement;},value:function(typeName)
  6802. {var option=this._options[this._filterComboBox.selectedIndex()];return option.value;},setSelectedIndex:function(index)
  6803. {this._filterComboBox.setSelectedIndex(index);},selectedIndex:function(index)
  6804. {return this._filterComboBox.selectedIndex();},_filterChanged:function(event)
  6805. {var option=this._options[this._filterComboBox.selectedIndex()];this._filterComboBox.element.title=option.title;this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},__proto__:WebInspector.Object.prototype}
  6806. WebInspector.CheckboxFilterUI=function(className,title,activeWhenChecked,setting)
  6807. {this._filterElement=createElement("div");this._filterElement.classList.add("filter-checkbox-filter","filter-checkbox-filter-"+className);this._activeWhenChecked=!!activeWhenChecked;this._createCheckbox(title);if(setting){this._setting=setting;setting.addChangeListener(this._settingChanged.bind(this));this._settingChanged();}else{this._checked=!this._activeWhenChecked;this._update();}}
  6808. WebInspector.CheckboxFilterUI.prototype={isActive:function()
  6809. {return this._activeWhenChecked===this._checked;},element:function()
  6810. {return this._filterElement;},checked:function()
  6811. {return this._checked;},setState:function(state)
  6812. {this._checked=state;if(this._setting)
  6813. this._setting.set(state);else
  6814. this._update();},_update:function()
  6815. {this._checkElement.classList.toggle("checkbox-filter-checkbox-checked",this._checked);this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},_settingChanged:function()
  6816. {this._checked=this._setting.get();this._update();},_onClick:function(event)
  6817. {this._checked=!this._checked;if(this._setting)
  6818. this._setting.set(this._checked);else
  6819. this._update();},_createCheckbox:function(title)
  6820. {var label=this._filterElement.createChild("label");var checkBorder=label.createChild("div","checkbox-filter-checkbox");this._checkElement=checkBorder.createChild("div","checkbox-filter-checkbox-check");this._filterElement.addEventListener("click",this._onClick.bind(this),false);var typeElement=label.createChild("span","type");typeElement.textContent=title;},__proto__:WebInspector.Object.prototype};WebInspector.FlameChartDelegate=function(){}
  6821. WebInspector.FlameChartDelegate.prototype={requestWindowTimes:function(startTime,endTime){},updateBoxSelection:function(startTime,endTime){}}
  6822. WebInspector.FlameChart=function(dataProvider,flameChartDelegate,isTopDown)
  6823. {WebInspector.HBox.call(this,true);this.registerRequiredCSS("ui/flameChart.css");this.contentElement.classList.add("flame-chart-main-pane");this._flameChartDelegate=flameChartDelegate;this._isTopDown=isTopDown;this._calculator=new WebInspector.FlameChart.Calculator();this._canvas=this.contentElement.createChild("canvas");this._canvas.tabIndex=1;this.setDefaultFocusedElement(this._canvas);this._canvas.addEventListener("mousemove",this._onMouseMove.bind(this),false);this._canvas.addEventListener("mousewheel",this._onMouseWheel.bind(this),false);this._canvas.addEventListener("click",this._onClick.bind(this),false);this._canvas.addEventListener("keydown",this._onKeyDown.bind(this),false);WebInspector.installDragHandle(this._canvas,this._startCanvasDragging.bind(this),this._canvasDragging.bind(this),this._endCanvasDragging.bind(this),"move",null);this._vScrollElement=this.contentElement.createChild("div","flame-chart-v-scroll");this._vScrollContent=this._vScrollElement.createChild("div");this._vScrollElement.addEventListener("scroll",this.scheduleUpdate.bind(this),false);this._entryInfo=this.contentElement.createChild("div","flame-chart-entry-info");this._markerHighlighElement=this.contentElement.createChild("div","flame-chart-marker-highlight-element");this._highlightElement=this.contentElement.createChild("div","flame-chart-highlight-element");this._selectedElement=this.contentElement.createChild("div","flame-chart-selected-element");this._selectionOverlay=this.contentElement.createChild("div","flame-chart-selection-overlay hidden");this._selectedTimeSpanLabel=this._selectionOverlay.createChild("div","time-span");this._dataProvider=dataProvider;this._windowLeft=0.0;this._windowRight=1.0;this._windowWidth=1.0;this._timeWindowLeft=0;this._timeWindowRight=Infinity;this._barHeight=dataProvider.barHeight();this._barHeightDelta=this._isTopDown?-this._barHeight:this._barHeight;this._minWidth=2;this._paddingLeft=this._dataProvider.paddingLeft();this._markerPadding=2;this._markerRadius=this._barHeight/2-this._markerPadding;this._highlightedMarkerIndex=-1;this._highlightedEntryIndex=-1;this._selectedEntryIndex=-1;this._rawTimelineDataLength=0;this._textWidth={};}
  6824. WebInspector.FlameChart.DividersBarHeight=20;WebInspector.FlameChart.MinimalTimeWindowMs=0.01;WebInspector.FlameChartDataProvider=function()
  6825. {}
  6826. WebInspector.FlameChart.TimelineData=function(entryLevels,entryTotalTimes,entryStartTimes)
  6827. {this.entryLevels=entryLevels;this.entryTotalTimes=entryTotalTimes;this.entryStartTimes=entryStartTimes;this.markers=[];this.flowStartTimes=[];this.flowStartLevels=[];this.flowEndTimes=[];this.flowEndLevels=[];}
  6828. WebInspector.FlameChartDataProvider.prototype={barHeight:function(){},dividerOffsets:function(startTime,endTime){},minimumBoundary:function(){},totalTime:function(){},maxStackDepth:function(){},timelineData:function(){},prepareHighlightedEntryInfo:function(entryIndex){},canJumpToEntry:function(entryIndex){},entryTitle:function(entryIndex){},entryFont:function(entryIndex){},entryColor:function(entryIndex){},decorateEntry:function(entryIndex,context,text,barX,barY,barWidth,barHeight){},forceDecoration:function(entryIndex){},textColor:function(entryIndex){},textBaseline:function(){},textPadding:function(){},highlightTimeRange:function(entryIndex){},paddingLeft:function(){},}
  6829. WebInspector.FlameChartMarker=function()
  6830. {}
  6831. WebInspector.FlameChartMarker.prototype={startTime:function(){},color:function(){},title:function(){},draw:function(context,x,height,pixelsPerMillisecond){},}
  6832. WebInspector.FlameChart.Events={EntrySelected:"EntrySelected"}
  6833. WebInspector.FlameChart.ColorGenerator=function(hueSpace,satSpace,lightnessSpace,alphaSpace)
  6834. {this._hueSpace=hueSpace||{min:0,max:360,count:20};this._satSpace=satSpace||67;this._lightnessSpace=lightnessSpace||80;this._alphaSpace=alphaSpace||1;this._colors={};}
  6835. WebInspector.FlameChart.ColorGenerator.prototype={setColorForID:function(id,color)
  6836. {this._colors[id]=color;},colorForID:function(id)
  6837. {var color=this._colors[id];if(!color){color=this._generateColorForID(id);this._colors[id]=color;}
  6838. return color;},_generateColorForID:function(id)
  6839. {var hash=id.hashCode();var h=this._indexToValueInSpace(hash,this._hueSpace);var s=this._indexToValueInSpace(hash,this._satSpace);var l=this._indexToValueInSpace(hash,this._lightnessSpace);var a=this._indexToValueInSpace(hash,this._alphaSpace);return"hsla("+h+", "+s+"%, "+l+"%, "+a+")";},_indexToValueInSpace:function(index,space)
  6840. {if(typeof space==="number")
  6841. return space;index%=space.count;return space.min+Math.floor(index/space.count*(space.max-space.min));}}
  6842. WebInspector.FlameChart.Calculator=function()
  6843. {this._paddingLeft=0;}
  6844. WebInspector.FlameChart.Calculator.prototype={paddingLeft:function()
  6845. {return this._paddingLeft;},_updateBoundaries:function(mainPane)
  6846. {this._totalTime=mainPane._dataProvider.totalTime();this._zeroTime=mainPane._dataProvider.minimumBoundary();this._minimumBoundaries=this._zeroTime+mainPane._windowLeft*this._totalTime;this._maximumBoundaries=this._zeroTime+mainPane._windowRight*this._totalTime;this._paddingLeft=mainPane._paddingLeft;this._width=mainPane._canvas.width/window.devicePixelRatio-this._paddingLeft;this._timeToPixel=this._width/this.boundarySpan();},computePosition:function(time)
  6847. {return Math.round((time-this._minimumBoundaries)*this._timeToPixel+this._paddingLeft);},formatTime:function(value,precision)
  6848. {return Number.preciseMillisToString(value-this._zeroTime,precision);},maximumBoundary:function()
  6849. {return this._maximumBoundaries;},minimumBoundary:function()
  6850. {return this._minimumBoundaries;},zeroTime:function()
  6851. {return this._zeroTime;},boundarySpan:function()
  6852. {return this._maximumBoundaries-this._minimumBoundaries;}}
  6853. WebInspector.FlameChart.prototype={_resetCanvas:function()
  6854. {var ratio=window.devicePixelRatio;this._canvas.width=this._offsetWidth*ratio;this._canvas.height=this._offsetHeight*ratio;this._canvas.style.width=this._offsetWidth+"px";this._canvas.style.height=this._offsetHeight+"px";},_timelineData:function()
  6855. {var timelineData=this._dataProvider.timelineData();if(timelineData!==this._rawTimelineData||timelineData.entryStartTimes.length!==this._rawTimelineDataLength)
  6856. this._processTimelineData(timelineData);return this._rawTimelineData;},_cancelAnimation:function()
  6857. {if(this._cancelWindowTimesAnimation){this._timeWindowLeft=this._pendingAnimationTimeLeft;this._timeWindowRight=this._pendingAnimationTimeRight;this._cancelWindowTimesAnimation();delete this._cancelWindowTimesAnimation;}},_revealEntry:function(entryIndex)
  6858. {var timelineData=this._timelineData();if(!timelineData)
  6859. return;var entryStartTime=timelineData.entryStartTimes[entryIndex];var entryTotalTime=timelineData.entryTotalTimes[entryIndex];var entryEndTime=entryStartTime+entryTotalTime;var minEntryTimeWindow=Math.min(entryTotalTime,this._timeWindowRight-this._timeWindowLeft);var y=this._levelToHeight(timelineData.entryLevels[entryIndex]);if(y<this._vScrollElement.scrollTop)
  6860. this._vScrollElement.scrollTop=y;else if(y>this._vScrollElement.scrollTop+this._offsetHeight+this._barHeightDelta)
  6861. this._vScrollElement.scrollTop=y-this._offsetHeight-this._barHeightDelta;if(this._timeWindowLeft>entryEndTime){var delta=this._timeWindowLeft-entryEndTime+minEntryTimeWindow;this._flameChartDelegate.requestWindowTimes(this._timeWindowLeft-delta,this._timeWindowRight-delta);}else if(this._timeWindowRight<entryStartTime){var delta=entryStartTime-this._timeWindowRight+minEntryTimeWindow;this._flameChartDelegate.requestWindowTimes(this._timeWindowLeft+delta,this._timeWindowRight+delta);}},setWindowTimes:function(startTime,endTime)
  6862. {if(this._muteAnimation||this._timeWindowLeft===0||this._timeWindowRight===Infinity||(startTime===0&&endTime===Infinity)){this._timeWindowLeft=startTime;this._timeWindowRight=endTime;this.scheduleUpdate();return;}
  6863. this._cancelAnimation();this._cancelWindowTimesAnimation=WebInspector.animateFunction(this.element.window(),this._animateWindowTimes.bind(this),[{from:this._timeWindowLeft,to:startTime},{from:this._timeWindowRight,to:endTime}],5,this._animationCompleted.bind(this));this._pendingAnimationTimeLeft=startTime;this._pendingAnimationTimeRight=endTime;},_animateWindowTimes:function(startTime,endTime)
  6864. {this._timeWindowLeft=startTime;this._timeWindowRight=endTime;this.update();},_animationCompleted:function()
  6865. {delete this._cancelWindowTimesAnimation;},_startCanvasDragging:function(event)
  6866. {if(event.shiftKey){this._startBoxSelection(event);this._isDragging=true;return true;}
  6867. if(!this._timelineData()||this._timeWindowRight===Infinity)
  6868. return false;this._isDragging=true;this._maxDragOffset=0;this._dragStartPointX=event.pageX;this._dragStartPointY=event.pageY;this._dragStartScrollTop=this._vScrollElement.scrollTop;this._dragStartWindowLeft=this._timeWindowLeft;this._dragStartWindowRight=this._timeWindowRight;this._canvas.style.cursor="";return true;},_canvasDragging:function(event)
  6869. {if(this._isSelecting){this._updateBoxSelection(event);return;}
  6870. var pixelShift=this._dragStartPointX-event.pageX;this._dragStartPointX=event.pageX;this._muteAnimation=true;this._handlePanGesture(pixelShift*this._pixelToTime);this._muteAnimation=false;var pixelScroll=this._dragStartPointY-event.pageY;this._vScrollElement.scrollTop=this._dragStartScrollTop+pixelScroll;this._maxDragOffset=Math.max(this._maxDragOffset,Math.abs(pixelShift));},_endCanvasDragging:function()
  6871. {this._hideBoxSelection();this._isDragging=false;},_startBoxSelection:function(event)
  6872. {this._selectionOffsetShiftX=event.offsetX-event.pageX;this._selectionOffsetShiftY=event.offsetY-event.pageY;this._selectionStartX=event.offsetX;this._selectionStartY=event.offsetY;this._isSelecting=true;var style=this._selectionOverlay.style;style.left=this._selectionStartX+"px";style.top=this._selectionStartY+"px";style.width="1px";style.height="1px";this._selectedTimeSpanLabel.textContent="";this._selectionOverlay.classList.remove("hidden");},_hideBoxSelection:function()
  6873. {this._selectionOffsetShiftX=null;this._selectionOffsetShiftY=null;this._selectionStartX=null;this._selectionStartY=null;this._isSelecting=false;this._selectionOverlay.classList.add("hidden");},_updateBoxSelection:function(event)
  6874. {var x=event.pageX+this._selectionOffsetShiftX;var y=event.pageY+this._selectionOffsetShiftY;x=Number.constrain(x,0,this._offsetWidth);y=Number.constrain(y,0,this._offsetHeight);var style=this._selectionOverlay.style;style.left=Math.min(x,this._selectionStartX)+"px";style.top=Math.min(y,this._selectionStartY)+"px";var selectionWidth=Math.abs(x-this._selectionStartX);style.width=selectionWidth+"px";style.height=Math.abs(y-this._selectionStartY)+"px";var timeSpan=selectionWidth*this._pixelToTime;this._selectedTimeSpanLabel.textContent=Number.preciseMillisToString(timeSpan,2);var start=this._cursorTime(this._selectionStartX);var end=this._cursorTime(x);if(end>start)
  6875. this._flameChartDelegate.updateBoxSelection(start,end);else
  6876. this._flameChartDelegate.updateBoxSelection(end,start);},_onMouseMove:function(event)
  6877. {this._lastMouseOffsetX=event.offsetX;if(!this._enabled())
  6878. return;if(this._isDragging)
  6879. return;var inDividersBar=event.offsetY<WebInspector.FlameChart.DividersBarHeight;this._highlightedMarkerIndex=inDividersBar?this._markerIndexAtPosition(event.offsetX):-1;this._updateMarkerHighlight();if(inDividersBar)
  6880. return;var entryIndex=this._coordinatesToEntryIndex(event.offsetX,event.offsetY);if(this._highlightedEntryIndex===entryIndex)
  6881. return;if(entryIndex===-1||!this._dataProvider.canJumpToEntry(entryIndex))
  6882. this._canvas.style.cursor="default";else
  6883. this._canvas.style.cursor="pointer";this._highlightedEntryIndex=entryIndex;this._updateElementPosition(this._highlightElement,this._highlightedEntryIndex);this._entryInfo.removeChildren();if(this._highlightedEntryIndex===-1)
  6884. return;if(!this._isDragging){var entryInfo=this._dataProvider.prepareHighlightedEntryInfo(this._highlightedEntryIndex);if(entryInfo)
  6885. this._entryInfo.appendChild(this._buildEntryInfo(entryInfo));}},_onClick:function()
  6886. {this.focus();const clickThreshold=5;if(this._maxDragOffset>clickThreshold)
  6887. return;if(this._highlightedEntryIndex===-1)
  6888. return;this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelected,this._highlightedEntryIndex);},_onMouseWheel:function(e)
  6889. {if(!this._enabled())
  6890. return;var panVertically=e.shiftKey&&(e.wheelDeltaY||Math.abs(e.wheelDeltaX)===120);var panHorizontally=Math.abs(e.wheelDeltaX)>Math.abs(e.wheelDeltaY)&&!e.shiftKey;if(panVertically){this._vScrollElement.scrollTop-=(e.wheelDeltaY||e.wheelDeltaX)/120*this._offsetHeight/8;}else if(panHorizontally){var shift=-e.wheelDeltaX*this._pixelToTime;this._muteAnimation=true;this._handlePanGesture(shift);this._muteAnimation=false;}else{const mouseWheelZoomSpeed=1/120;this._handleZoomGesture(Math.pow(1.2,-(e.wheelDeltaY||e.wheelDeltaX)*mouseWheelZoomSpeed)-1);}
  6891. e.consume(true);},_onKeyDown:function(e)
  6892. {if(e.altKey||e.ctrlKey||e.metaKey)
  6893. return;var zoomMultiplier=e.shiftKey?0.8:0.3;var panMultiplier=e.shiftKey?320:80;if(e.keyCode==="A".charCodeAt(0)){this._handlePanGesture(-panMultiplier*this._pixelToTime);e.consume(true);}else if(e.keyCode==="D".charCodeAt(0)){this._handlePanGesture(panMultiplier*this._pixelToTime);e.consume(true);}else if(e.keyCode==="W".charCodeAt(0)){this._handleZoomGesture(-zoomMultiplier);e.consume(true);}else if(e.keyCode==="S".charCodeAt(0)){this._handleZoomGesture(zoomMultiplier);e.consume(true);}},_handleZoomGesture:function(zoom)
  6894. {this._cancelAnimation();var bounds=this._windowForGesture();var cursorTime=this._cursorTime(this._lastMouseOffsetX);bounds.left+=(bounds.left-cursorTime)*zoom;bounds.right+=(bounds.right-cursorTime)*zoom;this._requestWindowTimes(bounds);},_handlePanGesture:function(shift)
  6895. {this._cancelAnimation();var bounds=this._windowForGesture();shift=Number.constrain(shift,this._minimumBoundary-bounds.left,this._totalTime+this._minimumBoundary-bounds.right);bounds.left+=shift;bounds.right+=shift;this._requestWindowTimes(bounds);},_windowForGesture:function()
  6896. {var windowLeft=this._timeWindowLeft?this._timeWindowLeft:this._dataProvider.minimumBoundary();var windowRight=this._timeWindowRight!==Infinity?this._timeWindowRight:this._dataProvider.minimumBoundary()+this._dataProvider.totalTime();return{left:windowLeft,right:windowRight};},_requestWindowTimes:function(bounds)
  6897. {bounds.left=Number.constrain(bounds.left,this._minimumBoundary,this._totalTime+this._minimumBoundary);bounds.right=Number.constrain(bounds.right,this._minimumBoundary,this._totalTime+this._minimumBoundary);if(bounds.right-bounds.left<WebInspector.FlameChart.MinimalTimeWindowMs)
  6898. return;this._flameChartDelegate.requestWindowTimes(bounds.left,bounds.right);},_cursorTime:function(x)
  6899. {return(x+this._pixelWindowLeft-this._paddingLeft)*this._pixelToTime+this._minimumBoundary;},_coordinatesToEntryIndex:function(x,y)
  6900. {y+=this._scrollTop;var timelineData=this._timelineData();if(!timelineData)
  6901. return-1;var cursorTime=this._cursorTime(x);var cursorLevel;var offsetFromLevel;if(this._isTopDown){cursorLevel=Math.floor((y-WebInspector.FlameChart.DividersBarHeight)/this._barHeight);offsetFromLevel=y-WebInspector.FlameChart.DividersBarHeight-cursorLevel*this._barHeight;}else{cursorLevel=Math.floor((this._canvas.height/window.devicePixelRatio-y)/this._barHeight);offsetFromLevel=this._canvas.height/window.devicePixelRatio-cursorLevel*this._barHeight;}
  6902. var entryStartTimes=timelineData.entryStartTimes;var entryTotalTimes=timelineData.entryTotalTimes;var entryIndexes=this._timelineLevels[cursorLevel];if(!entryIndexes||!entryIndexes.length)
  6903. return-1;function comparator(time,entryIndex)
  6904. {return time-entryStartTimes[entryIndex];}
  6905. var indexOnLevel=Math.max(entryIndexes.upperBound(cursorTime,comparator)-1,0);function checkEntryHit(entryIndex)
  6906. {if(entryIndex===undefined)
  6907. return false;var startTime=entryStartTimes[entryIndex];var duration=entryTotalTimes[entryIndex];if(isNaN(duration)){var dx=(startTime-cursorTime)/this._pixelToTime;var dy=this._barHeight/2-offsetFromLevel;return dx*dx+dy*dy<this._markerRadius*this._markerRadius;}
  6908. var endTime=startTime+duration;var barThreshold=3*this._pixelToTime;return startTime-barThreshold<cursorTime&&cursorTime<endTime+barThreshold;}
  6909. var entryIndex=entryIndexes[indexOnLevel];if(checkEntryHit.call(this,entryIndex))
  6910. return entryIndex;entryIndex=entryIndexes[indexOnLevel+1];if(checkEntryHit.call(this,entryIndex))
  6911. return entryIndex;return-1;},_markerIndexAtPosition:function(x)
  6912. {var markers=this._timelineData().markers;if(!markers)
  6913. return-1;var accurracyOffsetPx=1;var time=this._cursorTime(x);var leftTime=this._cursorTime(x-accurracyOffsetPx);var rightTime=this._cursorTime(x+accurracyOffsetPx);var left=this._markerIndexBeforeTime(leftTime);var markerIndex=-1;var distance=Infinity;for(var i=left;i<markers.length&&markers[i].startTime()<rightTime;i++){var nextDistance=Math.abs(markers[i].startTime()-time);if(nextDistance<distance){markerIndex=i;distance=nextDistance;}}
  6914. return markerIndex;},_markerIndexBeforeTime:function(time)
  6915. {function comparator(markerTimestamp,marker)
  6916. {return markerTimestamp-marker.startTime();}
  6917. return this._timelineData().markers.lowerBound(time,comparator);},_draw:function(width,height)
  6918. {var timelineData=this._timelineData();if(!timelineData)
  6919. return;var context=this._canvas.getContext("2d");context.save();var ratio=window.devicePixelRatio;context.scale(ratio,ratio);var timeWindowRight=this._timeWindowRight;var timeWindowLeft=this._timeWindowLeft;var minWidth=this._minWidth;var entryTotalTimes=timelineData.entryTotalTimes;var entryStartTimes=timelineData.entryStartTimes;var entryLevels=timelineData.entryLevels;var titleIndices=new Uint32Array(entryTotalTimes.length);var nextTitleIndex=0;var markerIndices=new Uint32Array(entryTotalTimes.length);var nextMarkerIndex=0;var textPadding=this._dataProvider.textPadding();this._minTextWidth=2*textPadding+this._measureWidth(context,"\u2026");var minTextWidth=this._minTextWidth;var barHeight=this._barHeight;var textBaseHeight=this._baseHeight+barHeight-this._dataProvider.textBaseline();var colorBuckets={};var minVisibleBarLevel=Math.max(Math.floor((this._scrollTop-this._baseHeight)/barHeight),0);var maxVisibleBarLevel=Math.min(Math.floor((this._scrollTop-this._baseHeight+height)/barHeight),this._dataProvider.maxStackDepth());context.translate(0,-this._scrollTop);function comparator(time,entryIndex)
  6920. {return time-entryStartTimes[entryIndex];}
  6921. for(var level=minVisibleBarLevel;level<=maxVisibleBarLevel;++level){var levelIndexes=this._timelineLevels[level];var rightIndexOnLevel=levelIndexes.lowerBound(timeWindowRight,comparator)-1;var lastDrawOffset=Infinity;for(var entryIndexOnLevel=rightIndexOnLevel;entryIndexOnLevel>=0;--entryIndexOnLevel){var entryIndex=levelIndexes[entryIndexOnLevel];var entryStartTime=entryStartTimes[entryIndex];var entryOffsetRight=entryStartTime+(isNaN(entryTotalTimes[entryIndex])?0:entryTotalTimes[entryIndex]);if(entryOffsetRight<=timeWindowLeft)
  6922. break;var barX=this._timeToPositionClipped(entryStartTime);if(barX>=lastDrawOffset)
  6923. continue;lastDrawOffset=barX;var color=this._dataProvider.entryColor(entryIndex);var bucket=colorBuckets[color];if(!bucket){bucket=[];colorBuckets[color]=bucket;}
  6924. bucket.push(entryIndex);}}
  6925. var colors=Object.keys(colorBuckets);for(var c=0;c<colors.length;++c){var color=colors[c];context.fillStyle=color;context.strokeStyle=color;var indexes=colorBuckets[color];context.beginPath();for(var i=0;i<indexes.length;++i){var entryIndex=indexes[i];var entryStartTime=entryStartTimes[entryIndex];var barX=this._timeToPositionClipped(entryStartTime);var barRight=this._timeToPositionClipped(entryStartTime+entryTotalTimes[entryIndex]);var barWidth=Math.max(barRight-barX,minWidth);var barLevel=entryLevels[entryIndex];var barY=this._levelToHeight(barLevel);if(isNaN(entryTotalTimes[entryIndex])){context.moveTo(barX+this._markerRadius,barY+barHeight/2);context.arc(barX,barY+barHeight/2,this._markerRadius,0,Math.PI*2);markerIndices[nextMarkerIndex++]=entryIndex;}else{context.rect(barX,barY,barWidth,barHeight);if(barWidth>minTextWidth||this._dataProvider.forceDecoration(entryIndex))
  6926. titleIndices[nextTitleIndex++]=entryIndex;}}
  6927. context.fill();}
  6928. context.strokeStyle="rgb(0, 0, 0)";context.beginPath();for(var m=0;m<nextMarkerIndex;++m){var entryIndex=markerIndices[m];var entryStartTime=entryStartTimes[entryIndex];var barX=this._timeToPositionClipped(entryStartTime);var barLevel=entryLevels[entryIndex];var barY=this._levelToHeight(barLevel);context.moveTo(barX+this._markerRadius,barY+barHeight/2);context.arc(barX,barY+barHeight/2,this._markerRadius,0,Math.PI*2);}
  6929. context.stroke();context.textBaseline="alphabetic";for(var i=0;i<nextTitleIndex;++i){var entryIndex=titleIndices[i];var entryStartTime=entryStartTimes[entryIndex];var barX=this._timeToPositionClipped(entryStartTime);var barRight=this._timeToPositionClipped(entryStartTime+entryTotalTimes[entryIndex]);var barWidth=Math.max(barRight-barX,minWidth);var barLevel=entryLevels[entryIndex];var barY=this._levelToHeight(barLevel);var text=this._dataProvider.entryTitle(entryIndex);if(text&&text.length){context.font=this._dataProvider.entryFont(entryIndex);text=this._prepareText(context,text,barWidth-2*textPadding);}
  6930. if(this._dataProvider.decorateEntry(entryIndex,context,text,barX,barY,barWidth,barHeight))
  6931. continue;if(!text||!text.length)
  6932. continue;context.fillStyle=this._dataProvider.textColor(entryIndex);context.fillText(text,barX+textPadding,textBaseHeight-barLevel*this._barHeightDelta);}
  6933. this._drawFlowEvents(context,width,height);context.restore();var offsets=this._dataProvider.dividerOffsets(this._calculator.minimumBoundary(),this._calculator.maximumBoundary());WebInspector.TimelineGrid.drawCanvasGrid(this._canvas,this._calculator,offsets);this._drawMarkers();this._updateElementPosition(this._highlightElement,this._highlightedEntryIndex);this._updateElementPosition(this._selectedElement,this._selectedEntryIndex);this._updateMarkerHighlight();},_drawFlowEvents:function(context,width,height)
  6934. {var timelineData=this._timelineData();var timeWindowRight=this._timeWindowRight;var timeWindowLeft=this._timeWindowLeft;var flowStartTimes=timelineData.flowStartTimes;var flowEndTimes=timelineData.flowEndTimes;var flowStartLevels=timelineData.flowStartLevels;var flowEndLevels=timelineData.flowEndLevels;var flowCount=flowStartTimes.length;var endIndex=flowStartTimes.lowerBound(timeWindowRight);var color=[];var fadeColorsCount=8;for(var i=0;i<=fadeColorsCount;++i)
  6935. color[i]="rgba(128, 0, 0, "+i/fadeColorsCount+")";var fadeColorsRange=color.length;var minimumFlowDistancePx=15;var flowArcHeight=4*this._barHeight;var colorIndex=0;context.lineWidth=0.5;for(var i=0;i<endIndex;++i){if(flowEndTimes[i]<timeWindowLeft)
  6936. continue;var startX=this._timeToPosition(flowStartTimes[i]);var endX=this._timeToPosition(flowEndTimes[i]);if(endX-startX<minimumFlowDistancePx)
  6937. continue;if(startX<-minimumFlowDistancePx&&endX>width+minimumFlowDistancePx)
  6938. continue;if(endX-startX<minimumFlowDistancePx+fadeColorsRange||colorIndex!==color.length-1){colorIndex=Math.min(fadeColorsRange-1,Math.floor(endX-startX-minimumFlowDistancePx));context.strokeStyle=color[colorIndex];}
  6939. var startY=this._levelToHeight(flowStartLevels[i])+this._barHeight;var endY=this._levelToHeight(flowEndLevels[i]);context.beginPath();context.moveTo(startX,startY);var arcHeight=Math.max(Math.sqrt(Math.abs(startY-endY)),flowArcHeight)+5;context.bezierCurveTo(startX,startY+arcHeight,endX,endY+arcHeight,endX,endY+this._barHeight);context.stroke();}},_drawMarkers:function()
  6940. {var markers=this._timelineData().markers;var left=this._markerIndexBeforeTime(this._calculator.minimumBoundary());var rightBoundary=this._calculator.maximumBoundary();var context=this._canvas.getContext("2d");context.save();var ratio=window.devicePixelRatio;context.scale(ratio,ratio);var height=WebInspector.FlameChart.DividersBarHeight-1;for(var i=left;i<markers.length;i++){var timestamp=markers[i].startTime();if(timestamp>rightBoundary)
  6941. break;markers[i].draw(context,this._calculator.computePosition(timestamp),height,this._timeToPixel);}
  6942. context.restore();},_updateMarkerHighlight:function()
  6943. {var element=this._markerHighlighElement;if(element.parentElement)
  6944. element.remove();var markerIndex=this._highlightedMarkerIndex;if(markerIndex===-1)
  6945. return;var marker=this._timelineData().markers[markerIndex];var barX=this._timeToPositionClipped(marker.startTime());element.title=marker.title();var style=element.style;style.left=barX+"px";style.backgroundColor=marker.color();this.contentElement.appendChild(element);},_processTimelineData:function(timelineData)
  6946. {if(!timelineData){this._timelineLevels=null;this._rawTimelineData=null;this._rawTimelineDataLength=0;return;}
  6947. var entryCounters=new Uint32Array(this._dataProvider.maxStackDepth()+1);for(var i=0;i<timelineData.entryLevels.length;++i)
  6948. ++entryCounters[timelineData.entryLevels[i]];var levelIndexes=new Array(entryCounters.length);for(var i=0;i<levelIndexes.length;++i){levelIndexes[i]=new Uint32Array(entryCounters[i]);entryCounters[i]=0;}
  6949. for(var i=0;i<timelineData.entryLevels.length;++i){var level=timelineData.entryLevels[i];levelIndexes[level][entryCounters[level]++]=i;}
  6950. this._timelineLevels=levelIndexes;this._rawTimelineData=timelineData;this._rawTimelineDataLength=timelineData.entryStartTimes.length;},setSelectedEntry:function(entryIndex)
  6951. {this._selectedEntryIndex=entryIndex;this._revealEntry(entryIndex);this._updateElementPosition(this._selectedElement,this._selectedEntryIndex);},_updateElementPosition:function(element,entryIndex)
  6952. {if(element.parentElement)
  6953. element.remove();if(entryIndex===-1)
  6954. return;var timeRange=this._dataProvider.highlightTimeRange(entryIndex);if(!timeRange)
  6955. return;var timelineData=this._timelineData();var barX=this._timeToPositionClipped(timeRange.startTime);var barRight=this._timeToPositionClipped(timeRange.endTime);if(barRight===0||barX===this._canvas.width)
  6956. return;var barWidth=Math.max(barRight-barX,this._minWidth);var barY=this._levelToHeight(timelineData.entryLevels[entryIndex])-this._scrollTop;var style=element.style;style.left=barX+"px";style.top=barY+"px";style.width=barWidth+"px";style.height=this._barHeight+"px";this.contentElement.appendChild(element);},_timeToPositionClipped:function(time)
  6957. {return Math.max(0,this._timeToPosition(time));},_timeToPosition:function(time)
  6958. {return Math.floor((time-this._minimumBoundary)*this._timeToPixel)-this._pixelWindowLeft+this._paddingLeft;},_levelToHeight:function(level)
  6959. {return this._baseHeight-level*this._barHeightDelta;},_buildEntryInfo:function(entryInfo)
  6960. {var infoTable=createElementWithClass("table","info-table");for(var i=0;i<entryInfo.length;++i){var row=infoTable.createChild("tr");row.createChild("td","title").textContent=entryInfo[i].title;row.createChild("td").textContent=entryInfo[i].text;}
  6961. return infoTable;},_prepareText:function(context,title,maxSize)
  6962. {var titleWidth=this._measureWidth(context,title);if(maxSize>=titleWidth)
  6963. return title;var l=2;var r=title.length;while(l<r){var m=(l+r)>>1;if(this._measureWidth(context,title.trimMiddle(m))<=maxSize)
  6964. l=m+1;else
  6965. r=m;}
  6966. title=title.trimMiddle(r-1);return title!=="\u2026"?title:"";},_measureWidth:function(context,text)
  6967. {if(text.length>20)
  6968. return context.measureText(text).width;var font=context.font;var textWidths=this._textWidth[font];if(!textWidths){textWidths={};this._textWidth[font]=textWidths;}
  6969. var width=textWidths[text];if(!width){width=context.measureText(text).width;textWidths[text]=width;}
  6970. return width;},_updateBoundaries:function()
  6971. {this._totalTime=this._dataProvider.totalTime();this._minimumBoundary=this._dataProvider.minimumBoundary();if(this._timeWindowRight!==Infinity){this._windowLeft=(this._timeWindowLeft-this._minimumBoundary)/this._totalTime;this._windowRight=(this._timeWindowRight-this._minimumBoundary)/this._totalTime;this._windowWidth=this._windowRight-this._windowLeft;}else{this._windowLeft=0;this._windowRight=1;this._windowWidth=1;}
  6972. this._pixelWindowWidth=this._offsetWidth-this._paddingLeft;this._totalPixels=Math.floor(this._pixelWindowWidth/this._windowWidth);this._pixelWindowLeft=Math.floor(this._totalPixels*this._windowLeft);this._pixelWindowRight=Math.floor(this._totalPixels*this._windowRight);this._timeToPixel=this._totalPixels/this._totalTime;this._pixelToTime=this._totalTime/this._totalPixels;this._paddingLeftTime=this._paddingLeft/this._timeToPixel;this._baseHeight=this._isTopDown?WebInspector.FlameChart.DividersBarHeight:this._offsetHeight-this._barHeight;this._totalHeight=this._levelToHeight(this._dataProvider.maxStackDepth()+1);this._vScrollContent.style.height=this._totalHeight+"px";this._scrollTop=this._vScrollElement.scrollTop;this._updateScrollBar();},onResize:function()
  6973. {this._updateScrollBar();this.scheduleUpdate();},_updateScrollBar:function()
  6974. {var showScroll=this._totalHeight>this._offsetHeight;this._vScrollElement.classList.toggle("hidden",!showScroll);this._offsetWidth=this.contentElement.offsetWidth-(WebInspector.isMac()?0:this._vScrollElement.offsetWidth);this._offsetHeight=this.contentElement.offsetHeight;},scheduleUpdate:function()
  6975. {if(this._updateTimerId||this._cancelWindowTimesAnimation)
  6976. return;this._updateTimerId=this.element.window().requestAnimationFrame(this.update.bind(this));},update:function()
  6977. {this._updateTimerId=0;if(!this._timelineData())
  6978. return;this._resetCanvas();this._updateBoundaries();this._calculator._updateBoundaries(this);this._draw(this._offsetWidth,this._offsetHeight);},reset:function()
  6979. {this._highlightedMarkerIndex=-1;this._highlightedEntryIndex=-1;this._selectedEntryIndex=-1;this._textWidth={};this.update();},_enabled:function()
  6980. {return this._rawTimelineDataLength!==0;},__proto__:WebInspector.HBox.prototype};WebInspector.ForwardedInputEventHandler=function()
  6981. {InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.KeyEventUnhandled,this._onKeyEventUnhandled,this);}
  6982. WebInspector.ForwardedInputEventHandler.prototype={_onKeyEventUnhandled:function(event)
  6983. {var data=event.data;var type=(data.type);var keyIdentifier=(data.keyIdentifier);var keyCode=(data.keyCode);var modifiers=(data.modifiers);if(type!=="keydown")
  6984. return;WebInspector.context.setFlavor(WebInspector.ShortcutRegistry.ForwardedShortcut,WebInspector.ShortcutRegistry.ForwardedShortcut.instance);WebInspector.shortcutRegistry.handleKey(WebInspector.KeyboardShortcut.makeKey(keyCode,modifiers),keyIdentifier);WebInspector.context.setFlavor(WebInspector.ShortcutRegistry.ForwardedShortcut,null);}}
  6985. WebInspector.forwardedEventHandler=new WebInspector.ForwardedInputEventHandler();;WebInspector.HelpScreen=function(title)
  6986. {WebInspector.VBox.call(this);this.markAsRoot();this.registerRequiredCSS("ui/helpScreen.css");this.element.classList.add("help-window-outer");this.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this.element.tabIndex=0;if(title){var mainWindow=this.element.createChild("div","help-window-main");var captionWindow=mainWindow.createChild("div","help-window-caption");captionWindow.appendChild(this._createCloseButton());this.helpContentElement=mainWindow.createChild("div","help-content");captionWindow.createChild("h1","help-window-title").textContent=title;}}
  6987. WebInspector.HelpScreen._visibleScreen=null;WebInspector.HelpScreen.prototype={_createCloseButton:function()
  6988. {var closeButton=createElement("div");closeButton.className="help-close-button close-button-gray";closeButton.addEventListener("click",this.hide.bind(this),false);return closeButton;},showModal:function()
  6989. {var visibleHelpScreen=WebInspector.HelpScreen._visibleScreen;if(visibleHelpScreen===this)
  6990. return;if(visibleHelpScreen)
  6991. visibleHelpScreen.hide();WebInspector.HelpScreen._visibleScreen=this;WebInspector.GlassPane.DefaultFocusedViewStack.push(this);this.show(WebInspector.Dialog.modalHostView().element);this.focus();},hide:function()
  6992. {if(!this.isShowing())
  6993. return;WebInspector.HelpScreen._visibleScreen=null;WebInspector.GlassPane.DefaultFocusedViewStack.pop();WebInspector.restoreFocusFromElement(this.element);this.detach();},isClosingKey:function(keyCode)
  6994. {return[WebInspector.KeyboardShortcut.Keys.Enter.code,WebInspector.KeyboardShortcut.Keys.Esc.code,WebInspector.KeyboardShortcut.Keys.Space.code,].indexOf(keyCode)>=0;},_onKeyDown:function(event)
  6995. {if(this.isShowing()&&this.isClosingKey(event.keyCode)){this.hide();event.consume();}},__proto__:WebInspector.VBox.prototype};WebInspector.InplaceEditor=function()
  6996. {}
  6997. WebInspector.InplaceEditor.Controller;WebInspector.InplaceEditor.startEditing=function(element,config)
  6998. {if(!WebInspector.InplaceEditor._defaultInstance)
  6999. WebInspector.InplaceEditor._defaultInstance=new WebInspector.InplaceEditor();return WebInspector.InplaceEditor._defaultInstance.startEditing(element,config);}
  7000. WebInspector.InplaceEditor.startMultilineEditing=function(element,config)
  7001. {return self.runtime.instancePromise(WebInspector.InplaceEditor).then(startEditing);function startEditing(inplaceEditor)
  7002. {var controller=(inplaceEditor).startEditing(element,config);if(!controller)
  7003. return Promise.reject(new Error("Editing is already in progress"));return controller;}}
  7004. WebInspector.InplaceEditor.prototype={editorContent:function(editingContext){var element=editingContext.element;if(element.tagName==="INPUT"&&element.type==="text")
  7005. return element.value;return element.textContent;},setUpEditor:function(editingContext)
  7006. {var element=editingContext.element;element.classList.add("editing");var oldTabIndex=element.getAttribute("tabIndex");if(typeof oldTabIndex!=="number"||oldTabIndex<0)
  7007. element.tabIndex=0;WebInspector.setCurrentFocusElement(element);editingContext.oldTabIndex=oldTabIndex;},closeEditor:function(editingContext)
  7008. {var element=editingContext.element;element.classList.remove("editing");if(typeof editingContext.oldTabIndex!=="number")
  7009. element.removeAttribute("tabIndex");else
  7010. element.tabIndex=editingContext.oldTabIndex;element.scrollTop=0;element.scrollLeft=0;},cancelEditing:function(editingContext)
  7011. {var element=editingContext.element;if(element.tagName==="INPUT"&&element.type==="text")
  7012. element.value=editingContext.oldText;else
  7013. element.textContent=editingContext.oldText;},augmentEditingHandle:function(editingContext,handle)
  7014. {},startEditing:function(element,config)
  7015. {if(!WebInspector.markBeingEdited(element,true))
  7016. return null;config=config||new WebInspector.InplaceEditor.Config(function(){},function(){});var editingContext={element:element,config:config};var committedCallback=config.commitHandler;var cancelledCallback=config.cancelHandler;var pasteCallback=config.pasteHandler;var context=config.context;var isMultiline=config.multiline||false;var moveDirection="";var self=this;function consumeCopy(e)
  7017. {e.consume();}
  7018. this.setUpEditor(editingContext);editingContext.oldText=isMultiline?config.initialValue:this.editorContent(editingContext);function blurEventListener(e){if(config.blurHandler&&!config.blurHandler(element,e))
  7019. return;if(!isMultiline||!e||!e.relatedTarget||!e.relatedTarget.isSelfOrDescendant(element))
  7020. editingCommitted.call(element);}
  7021. function cleanUpAfterEditing()
  7022. {WebInspector.markBeingEdited(element,false);element.removeEventListener("blur",blurEventListener,isMultiline);element.removeEventListener("keydown",keyDownEventListener,true);if(pasteCallback)
  7023. element.removeEventListener("paste",pasteEventListener,true);WebInspector.restoreFocusFromElement(element);self.closeEditor(editingContext);}
  7024. function editingCancelled()
  7025. {self.cancelEditing(editingContext);cleanUpAfterEditing();cancelledCallback(this,context);}
  7026. function editingCommitted()
  7027. {cleanUpAfterEditing();committedCallback(this,self.editorContent(editingContext),editingContext.oldText,context,moveDirection);}
  7028. function defaultFinishHandler(event)
  7029. {var isMetaOrCtrl=WebInspector.isMac()?event.metaKey&&!event.shiftKey&&!event.ctrlKey&&!event.altKey:event.ctrlKey&&!event.shiftKey&&!event.metaKey&&!event.altKey;if(isEnterKey(event)&&(event.isMetaOrCtrlForTest||!isMultiline||isMetaOrCtrl))
  7030. return"commit";else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code||event.keyIdentifier==="U+001B")
  7031. return"cancel";else if(!isMultiline&&event.keyIdentifier==="U+0009")
  7032. return"move-"+(event.shiftKey?"backward":"forward");}
  7033. function handleEditingResult(result,event)
  7034. {if(result==="commit"){editingCommitted.call(element);event.consume(true);}else if(result==="cancel"){editingCancelled.call(element);event.consume(true);}else if(result&&result.startsWith("move-")){moveDirection=result.substring(5);if(event.keyIdentifier!=="U+0009")
  7035. blurEventListener();}}
  7036. function pasteEventListener(event)
  7037. {var result=pasteCallback(event);handleEditingResult(result,event);}
  7038. function keyDownEventListener(event)
  7039. {var handler=config.customFinishHandler||defaultFinishHandler;var result=handler(event);handleEditingResult(result,event);}
  7040. element.addEventListener("blur",blurEventListener,isMultiline);element.addEventListener("keydown",keyDownEventListener,true);if(pasteCallback)
  7041. element.addEventListener("paste",pasteEventListener,true);var handle={cancel:editingCancelled.bind(element),commit:editingCommitted.bind(element),setWidth:function(){}};this.augmentEditingHandle(editingContext,handle);return handle;}}
  7042. WebInspector.InplaceEditor.Config=function(commitHandler,cancelHandler,context,blurHandler)
  7043. {this.commitHandler=commitHandler;this.cancelHandler=cancelHandler;this.context=context;this.blurHandler=blurHandler;this.pasteHandler;this.multiline;this.customFinishHandler;}
  7044. WebInspector.InplaceEditor.Config.prototype={setPasteHandler:function(pasteHandler)
  7045. {this.pasteHandler=pasteHandler;},setMultilineOptions:function(initialValue,mode,theme,lineWrapping,smartIndent)
  7046. {this.multiline=true;this.initialValue=initialValue;this.mode=mode;this.theme=theme;this.lineWrapping=lineWrapping;this.smartIndent=smartIndent;},setCustomFinishHandler:function(customFinishHandler)
  7047. {this.customFinishHandler=customFinishHandler;}};WebInspector.KeyboardShortcut=function()
  7048. {}
  7049. WebInspector.KeyboardShortcut.Modifiers={None:0,Shift:1,Ctrl:2,Alt:4,Meta:8,get CtrlOrMeta()
  7050. {return WebInspector.isMac()?this.Meta:this.Ctrl;},get ShiftOrOption()
  7051. {return WebInspector.isMac()?this.Alt:this.Shift;}};WebInspector.KeyboardShortcut.Key;WebInspector.KeyboardShortcut.Keys={Backspace:{code:8,name:"\u21a4"},Tab:{code:9,name:{mac:"\u21e5",other:"Tab"}},Enter:{code:13,name:{mac:"\u21a9",other:"Enter"}},Shift:{code:16,name:{mac:"\u21e7",other:"Shift"}},Ctrl:{code:17,name:"Ctrl"},Esc:{code:27,name:{mac:"\u238b",other:"Esc"}},Space:{code:32,name:"Space"},PageUp:{code:33,name:{mac:"\u21de",other:"PageUp"}},PageDown:{code:34,name:{mac:"\u21df",other:"PageDown"}},End:{code:35,name:{mac:"\u2197",other:"End"}},Home:{code:36,name:{mac:"\u2196",other:"Home"}},Left:{code:37,name:"\u2190"},Up:{code:38,name:"\u2191"},Right:{code:39,name:"\u2192"},Down:{code:40,name:"\u2193"},Delete:{code:46,name:"Del"},Zero:{code:48,name:"0"},H:{code:72,name:"H"},Meta:{code:91,name:"Meta"},F1:{code:112,name:"F1"},F2:{code:113,name:"F2"},F3:{code:114,name:"F3"},F4:{code:115,name:"F4"},F5:{code:116,name:"F5"},F6:{code:117,name:"F6"},F7:{code:118,name:"F7"},F8:{code:119,name:"F8"},F9:{code:120,name:"F9"},F10:{code:121,name:"F10"},F11:{code:122,name:"F11"},F12:{code:123,name:"F12"},Semicolon:{code:186,name:";"},NumpadPlus:{code:107,name:"Numpad +"},NumpadMinus:{code:109,name:"Numpad -"},Numpad0:{code:96,name:"Numpad 0"},Plus:{code:187,name:"+"},Comma:{code:188,name:","},Minus:{code:189,name:"-"},Period:{code:190,name:"."},Slash:{code:191,name:"/"},QuestionMark:{code:191,name:"?"},Apostrophe:{code:192,name:"`"},Tilde:{code:192,name:"Tilde"},Backslash:{code:220,name:"\\"},SingleQuote:{code:222,name:"\'"},get CtrlOrMeta()
  7052. {return WebInspector.isMac()?this.Meta:this.Ctrl;},};WebInspector.KeyboardShortcut.KeyBindings={};(function(){for(var key in WebInspector.KeyboardShortcut.Keys){var descriptor=WebInspector.KeyboardShortcut.Keys[key];if(typeof descriptor==="object"&&descriptor["code"]){var name=typeof descriptor["name"]==="string"?descriptor["name"]:key;WebInspector.KeyboardShortcut.KeyBindings[name]=descriptor;}}})();WebInspector.KeyboardShortcut.makeKey=function(keyCode,modifiers)
  7053. {if(typeof keyCode==="string")
  7054. keyCode=keyCode.charCodeAt(0)-(/^[a-z]/.test(keyCode)?32:0);modifiers=modifiers||WebInspector.KeyboardShortcut.Modifiers.None;return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode,modifiers);}
  7055. WebInspector.KeyboardShortcut.makeKeyFromEvent=function(keyboardEvent)
  7056. {var modifiers=WebInspector.KeyboardShortcut.Modifiers.None;if(keyboardEvent.shiftKey)
  7057. modifiers|=WebInspector.KeyboardShortcut.Modifiers.Shift;if(keyboardEvent.ctrlKey)
  7058. modifiers|=WebInspector.KeyboardShortcut.Modifiers.Ctrl;if(keyboardEvent.altKey)
  7059. modifiers|=WebInspector.KeyboardShortcut.Modifiers.Alt;if(keyboardEvent.metaKey)
  7060. modifiers|=WebInspector.KeyboardShortcut.Modifiers.Meta;var keyCode=keyboardEvent.keyCode||keyboardEvent["__keyCode"];return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode,modifiers);}
  7061. WebInspector.KeyboardShortcut.makeKeyFromEventIgnoringModifiers=function(keyboardEvent)
  7062. {var keyCode=keyboardEvent.keyCode||keyboardEvent["__keyCode"];return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode,WebInspector.KeyboardShortcut.Modifiers.None);}
  7063. WebInspector.KeyboardShortcut.eventHasCtrlOrMeta=function(event)
  7064. {return WebInspector.isMac()?event.metaKey&&!event.ctrlKey:event.ctrlKey&&!event.metaKey;}
  7065. WebInspector.KeyboardShortcut.hasNoModifiers=function(event)
  7066. {return!event.ctrlKey&&!event.shiftKey&&!event.altKey&&!event.metaKey;}
  7067. WebInspector.KeyboardShortcut.Descriptor;WebInspector.KeyboardShortcut.makeDescriptor=function(key,modifiers)
  7068. {return{key:WebInspector.KeyboardShortcut.makeKey(typeof key==="string"?key:key.code,modifiers),name:WebInspector.KeyboardShortcut.shortcutToString(key,modifiers)};}
  7069. WebInspector.KeyboardShortcut.makeDescriptorFromBindingShortcut=function(shortcut)
  7070. {var parts=shortcut.split(/\+(?!$)/);var modifiers=0;var keyString;for(var i=0;i<parts.length;++i){if(typeof WebInspector.KeyboardShortcut.Modifiers[parts[i]]!=="undefined"){modifiers|=WebInspector.KeyboardShortcut.Modifiers[parts[i]];continue;}
  7071. console.assert(i===parts.length-1,"Only one key other than modifier is allowed in shortcut <"+shortcut+">");keyString=parts[i];break;}
  7072. console.assert(keyString,"Modifiers-only shortcuts are not allowed (encountered <"+shortcut+">)");if(!keyString)
  7073. return null;var key=WebInspector.KeyboardShortcut.Keys[keyString]||WebInspector.KeyboardShortcut.KeyBindings[keyString];if(key&&key.shiftKey)
  7074. modifiers|=WebInspector.KeyboardShortcut.Modifiers.Shift;return WebInspector.KeyboardShortcut.makeDescriptor(key?key:keyString,modifiers);}
  7075. WebInspector.KeyboardShortcut.shortcutToString=function(key,modifiers)
  7076. {return WebInspector.KeyboardShortcut._modifiersToString(modifiers)+WebInspector.KeyboardShortcut._keyName(key);}
  7077. WebInspector.KeyboardShortcut._keyName=function(key)
  7078. {if(typeof key==="string")
  7079. return key.toUpperCase();if(typeof key.name==="string")
  7080. return key.name;return key.name[WebInspector.platform()]||key.name.other||'';}
  7081. WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers=function(keyCode,modifiers)
  7082. {return(keyCode&255)|(modifiers<<8);};WebInspector.KeyboardShortcut.keyCodeAndModifiersFromKey=function(key)
  7083. {return{keyCode:key&255,modifiers:key>>8};}
  7084. WebInspector.KeyboardShortcut._modifiersToString=function(modifiers)
  7085. {const cmdKey="\u2318";const optKey="\u2325";const shiftKey="\u21e7";const ctrlKey="\u2303";var isMac=WebInspector.isMac();var res="";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Ctrl)
  7086. res+=isMac?ctrlKey:"Ctrl + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Alt)
  7087. res+=isMac?optKey:"Alt + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Shift)
  7088. res+=isMac?shiftKey:"Shift + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Meta)
  7089. res+=isMac?cmdKey:"Win + ";return res;};WebInspector.KeyboardShortcut.SelectAll=WebInspector.KeyboardShortcut.makeKey("a",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);;WebInspector.OverviewGrid=function(prefix)
  7090. {this.element=createElement("div");this.element.id=prefix+"-overview-container";this._grid=new WebInspector.TimelineGrid();this._grid.element.id=prefix+"-overview-grid";this._grid.setScrollTop(0);this.element.appendChild(this._grid.element);this._window=new WebInspector.OverviewGrid.Window(this.element,this._grid.dividersLabelBarElement);}
  7091. WebInspector.OverviewGrid.prototype={clientWidth:function()
  7092. {return this.element.clientWidth;},updateDividers:function(calculator)
  7093. {this._grid.updateDividers(calculator);},addEventDividers:function(dividers)
  7094. {this._grid.addEventDividers(dividers);},removeEventDividers:function()
  7095. {this._grid.removeEventDividers();},setWindowPosition:function(start,end)
  7096. {this._window._setWindowPosition(start,end);},reset:function()
  7097. {this._window.reset();},windowLeft:function()
  7098. {return this._window.windowLeft;},windowRight:function()
  7099. {return this._window.windowRight;},setWindow:function(left,right)
  7100. {this._window._setWindow(left,right);},addEventListener:function(eventType,listener,thisObject)
  7101. {this._window.addEventListener(eventType,listener,thisObject);},zoom:function(zoomFactor,referencePoint)
  7102. {this._window._zoom(zoomFactor,referencePoint);},setResizeEnabled:function(enabled)
  7103. {this._window._setEnabled(!!enabled);}}
  7104. WebInspector.OverviewGrid.MinSelectableSize=14;WebInspector.OverviewGrid.WindowScrollSpeedFactor=.3;WebInspector.OverviewGrid.ResizerOffset=3.5;WebInspector.OverviewGrid.Window=function(parentElement,dividersLabelBarElement)
  7105. {this._parentElement=parentElement;WebInspector.installDragHandle(this._parentElement,this._startWindowSelectorDragging.bind(this),this._windowSelectorDragging.bind(this),this._endWindowSelectorDragging.bind(this),"ew-resize",null);if(dividersLabelBarElement)
  7106. WebInspector.installDragHandle(dividersLabelBarElement,this._startWindowDragging.bind(this),this._windowDragging.bind(this),null,"move");this.windowLeft=0.0;this.windowRight=1.0;this._parentElement.addEventListener("mousewheel",this._onMouseWheel.bind(this),true);this._parentElement.addEventListener("dblclick",this._resizeWindowMaximum.bind(this),true);this._overviewWindowElement=parentElement.createChild("div","overview-grid-window");this._overviewWindowElement.appendChild(WebInspector.View.createStyleElement("ui/overviewGrid.css"));this._overviewWindowBordersElement=parentElement.createChild("div","overview-grid-window-rulers");parentElement.createChild("div","overview-grid-dividers-background");this._leftResizeElement=parentElement.createChild("div","overview-grid-window-resizer");this._leftResizeElement.style.left=0;WebInspector.installDragHandle(this._leftResizeElement,this._resizerElementStartDragging.bind(this),this._leftResizeElementDragging.bind(this),null,"ew-resize");this._rightResizeElement=parentElement.createChild("div","overview-grid-window-resizer overview-grid-window-resizer-right");this._rightResizeElement.style.right=0;WebInspector.installDragHandle(this._rightResizeElement,this._resizerElementStartDragging.bind(this),this._rightResizeElementDragging.bind(this),null,"ew-resize");this._setEnabled(true);}
  7107. WebInspector.OverviewGrid.Events={WindowChanged:"WindowChanged"}
  7108. WebInspector.OverviewGrid.Window.prototype={reset:function()
  7109. {this.windowLeft=0.0;this.windowRight=1.0;this._overviewWindowElement.style.left="0%";this._overviewWindowElement.style.width="100%";this._overviewWindowBordersElement.style.left="0%";this._overviewWindowBordersElement.style.right="0%";this._leftResizeElement.style.left="0%";this._rightResizeElement.style.left="100%";this._setEnabled(true);},_setEnabled:function(enabled)
  7110. {enabled=!!enabled;if(this._enabled===enabled)
  7111. return;this._enabled=enabled;},_resizerElementStartDragging:function(event)
  7112. {if(!this._enabled)
  7113. return false;this._resizerParentOffsetLeft=event.pageX-event.offsetX-event.target.offsetLeft;event.preventDefault();return true;},_leftResizeElementDragging:function(event)
  7114. {this._resizeWindowLeft(event.pageX-this._resizerParentOffsetLeft);event.preventDefault();},_rightResizeElementDragging:function(event)
  7115. {this._resizeWindowRight(event.pageX-this._resizerParentOffsetLeft);event.preventDefault();},_startWindowSelectorDragging:function(event)
  7116. {if(!this._enabled)
  7117. return false;this._offsetLeft=this._parentElement.totalOffsetLeft();var position=event.x-this._offsetLeft;this._overviewWindowSelector=new WebInspector.OverviewGrid.WindowSelector(this._parentElement,position);return true;},_windowSelectorDragging:function(event)
  7118. {this._overviewWindowSelector._updatePosition(event.x-this._offsetLeft);event.preventDefault();},_endWindowSelectorDragging:function(event)
  7119. {var window=this._overviewWindowSelector._close(event.x-this._offsetLeft);delete this._overviewWindowSelector;if(window.end===window.start){var middle=window.end;window.start=Math.max(0,middle-WebInspector.OverviewGrid.MinSelectableSize/2);window.end=Math.min(this._parentElement.clientWidth,middle+WebInspector.OverviewGrid.MinSelectableSize/2);}else if(window.end-window.start<WebInspector.OverviewGrid.MinSelectableSize){if(this._parentElement.clientWidth-window.end>WebInspector.OverviewGrid.MinSelectableSize)
  7120. window.end=window.start+WebInspector.OverviewGrid.MinSelectableSize;else
  7121. window.start=window.end-WebInspector.OverviewGrid.MinSelectableSize;}
  7122. this._setWindowPosition(window.start,window.end);},_startWindowDragging:function(event)
  7123. {this._dragStartPoint=event.pageX;this._dragStartLeft=this.windowLeft;this._dragStartRight=this.windowRight;return true;},_windowDragging:function(event)
  7124. {event.preventDefault();var delta=(event.pageX-this._dragStartPoint)/this._parentElement.clientWidth;if(this._dragStartLeft+delta<0)
  7125. delta=-this._dragStartLeft;if(this._dragStartRight+delta>1)
  7126. delta=1-this._dragStartRight;this._setWindow(this._dragStartLeft+delta,this._dragStartRight+delta);},_resizeWindowLeft:function(start)
  7127. {if(start<10)
  7128. start=0;else if(start>this._rightResizeElement.offsetLeft-4)
  7129. start=this._rightResizeElement.offsetLeft-4;this._setWindowPosition(start,null);},_resizeWindowRight:function(end)
  7130. {if(end>this._parentElement.clientWidth-10)
  7131. end=this._parentElement.clientWidth;else if(end<this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.MinSelectableSize)
  7132. end=this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.MinSelectableSize;this._setWindowPosition(null,end);},_resizeWindowMaximum:function()
  7133. {this._setWindowPosition(0,this._parentElement.clientWidth);},_setWindow:function(windowLeft,windowRight)
  7134. {var left=windowLeft;var right=windowRight;var width=windowRight-windowLeft;var widthInPixels=width*this._parentElement.clientWidth;var minWidthInPixels=WebInspector.OverviewGrid.MinSelectableSize/2;if(widthInPixels<minWidthInPixels){var factor=minWidthInPixels/widthInPixels;left=((windowRight+windowLeft)-width*factor)/2;right=((windowRight+windowLeft)+width*factor)/2;}
  7135. this.windowLeft=windowLeft;this._leftResizeElement.style.left=left*100+"%";this.windowRight=windowRight;this._rightResizeElement.style.left=right*100+"%";this._overviewWindowElement.style.left=left*100+"%";this._overviewWindowBordersElement.style.left=left*100+"%";this._overviewWindowElement.style.width=(right-left)*100+"%";this._overviewWindowBordersElement.style.right=(1-right)*100+"%";this.dispatchEventToListeners(WebInspector.OverviewGrid.Events.WindowChanged);},_setWindowPosition:function(start,end)
  7136. {var clientWidth=this._parentElement.clientWidth;var windowLeft=typeof start==="number"?start/clientWidth:this.windowLeft;var windowRight=typeof end==="number"?end/clientWidth:this.windowRight;this._setWindow(windowLeft,windowRight);},_onMouseWheel:function(event)
  7137. {if(!this._enabled)
  7138. return;if(typeof event.wheelDeltaY==="number"&&event.wheelDeltaY){const zoomFactor=1.1;const mouseWheelZoomSpeed=1/120;var reference=event.offsetX/event.target.clientWidth;this._zoom(Math.pow(zoomFactor,-event.wheelDeltaY*mouseWheelZoomSpeed),reference);}
  7139. if(typeof event.wheelDeltaX==="number"&&event.wheelDeltaX){var offset=Math.round(event.wheelDeltaX*WebInspector.OverviewGrid.WindowScrollSpeedFactor);var windowLeft=this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.ResizerOffset;var windowRight=this._rightResizeElement.offsetLeft+WebInspector.OverviewGrid.ResizerOffset;if(windowLeft-offset<0)
  7140. offset=windowLeft;if(windowRight-offset>this._parentElement.clientWidth)
  7141. offset=windowRight-this._parentElement.clientWidth;this._setWindowPosition(windowLeft-offset,windowRight-offset);event.preventDefault();}},_zoom:function(factor,reference)
  7142. {var left=this.windowLeft;var right=this.windowRight;var windowSize=right-left;var newWindowSize=factor*windowSize;if(newWindowSize>1){newWindowSize=1;factor=newWindowSize/windowSize;}
  7143. left=reference+(left-reference)*factor;left=Number.constrain(left,0,1-newWindowSize);right=reference+(right-reference)*factor;right=Number.constrain(right,newWindowSize,1);this._setWindow(left,right);},__proto__:WebInspector.Object.prototype}
  7144. WebInspector.OverviewGrid.WindowSelector=function(parent,position)
  7145. {this._startPosition=position;this._width=parent.offsetWidth;this._windowSelector=createElement("div");this._windowSelector.className="overview-grid-window-selector";this._windowSelector.style.left=this._startPosition+"px";this._windowSelector.style.right=this._width-this._startPosition+"px";parent.appendChild(this._windowSelector);}
  7146. WebInspector.OverviewGrid.WindowSelector.prototype={_close:function(position)
  7147. {position=Math.max(0,Math.min(position,this._width));this._windowSelector.remove();return this._startPosition<position?{start:this._startPosition,end:position}:{start:position,end:this._startPosition};},_updatePosition:function(position)
  7148. {position=Math.max(0,Math.min(position,this._width));if(position<this._startPosition){this._windowSelector.style.left=position+"px";this._windowSelector.style.right=this._width-this._startPosition+"px";}else{this._windowSelector.style.left=this._startPosition+"px";this._windowSelector.style.right=this._width-position+"px";}}};WebInspector.Panel=function(name)
  7149. {WebInspector.VBox.call(this);this.element.classList.add("panel");this.element.classList.add(name);this._panelName=name;this._shortcuts=({});}
  7150. WebInspector.Panel.counterRightMargin=25;WebInspector.Panel.prototype={get name()
  7151. {return this._panelName;},reset:function()
  7152. {},defaultFocusedElement:function()
  7153. {return this.element;},searchableView:function()
  7154. {return null;},elementsToRestoreScrollPositionsFor:function()
  7155. {return[];},handleShortcut:function(event)
  7156. {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcutKey];if(handler&&handler(event)){event.handled=true;return;}
  7157. var searchableView=this.searchableView();if(!searchableView)
  7158. return;function handleSearchShortcuts(shortcuts,handler)
  7159. {for(var i=0;i<shortcuts.length;++i){if(shortcuts[i].key!==shortcutKey)
  7160. continue;return handler.call(searchableView);}
  7161. return false;}
  7162. if(handleSearchShortcuts(WebInspector.SearchableView.findShortcuts(),searchableView.handleFindShortcut))
  7163. event.handled=true;else if(handleSearchShortcuts(WebInspector.SearchableView.cancelSearchShortcuts(),searchableView.handleCancelSearchShortcut))
  7164. event.handled=true;},registerShortcuts:function(keys,handler)
  7165. {for(var i=0;i<keys.length;++i)
  7166. this._shortcuts[keys[i].key]=handler;},__proto__:WebInspector.VBox.prototype}
  7167. WebInspector.PanelWithSidebarTree=function(name,defaultWidth)
  7168. {WebInspector.Panel.call(this,name);this._panelSplitView=new WebInspector.SplitView(true,false,this._panelName+"PanelSplitViewState",defaultWidth||200);this._panelSplitView.show(this.element);this._mainView=new WebInspector.VBox();this._panelSplitView.setMainView(this._mainView);this._sidebarView=new WebInspector.VBox();this._sidebarView.setMinimumSize(100,25);this._panelSplitView.setSidebarView(this._sidebarView);this._sidebarView.element.classList.add("sidebar");var sidebarTreeElement=this._sidebarView.element.createChild("ol","sidebar-tree");this.sidebarTree=new TreeOutline(sidebarTreeElement);}
  7169. WebInspector.PanelWithSidebarTree.prototype={panelSidebarElement:function()
  7170. {return this._sidebarView.element;},mainElement:function()
  7171. {return this._mainView.element;},splitView:function()
  7172. {return this._panelSplitView;},defaultFocusedElement:function()
  7173. {return this.sidebarTree.element||this.element;},__proto__:WebInspector.Panel.prototype}
  7174. WebInspector.PanelDescriptor=function()
  7175. {}
  7176. WebInspector.PanelDescriptor.prototype={name:function(){},title:function(){},panel:function(){}}
  7177. WebInspector.PanelFactory=function()
  7178. {}
  7179. WebInspector.PanelFactory.prototype={createPanel:function(){}}
  7180. WebInspector.RuntimeExtensionPanelDescriptor=function(extension)
  7181. {this._name=extension.descriptor()["name"];this._title=WebInspector.UIString(extension.descriptor()["title"]);this._extension=extension;}
  7182. WebInspector.RuntimeExtensionPanelDescriptor.prototype={name:function()
  7183. {return this._name;},title:function()
  7184. {return this._title;},panel:function()
  7185. {return this._extension.instancePromise().then(createPanel);function createPanel(panelFactory)
  7186. {return(panelFactory).createPanel();}}};WebInspector.PieChart=function(size,formatter,showTotal)
  7187. {var shadowSize=WebInspector.PieChart._ShadowSizePercent;this.element=createElement("div");this._shadowRoot=this.element.createShadowRoot();this._shadowRoot.appendChild(WebInspector.View.createStyleElement("ui/pieChart.css"));var root=this._shadowRoot.createChild("div","root");var svg=this._createSVGChild(root,"svg");svg.setAttribute("width",(100*(1+2*shadowSize))+"%");svg.setAttribute("height",(100*(1+2*shadowSize))+"%");this._group=this._createSVGChild(svg,"g");var shadow=this._createSVGChild(this._group,"circle");shadow.setAttribute("r",1+shadowSize);shadow.setAttribute("cy",shadowSize);shadow.setAttribute("fill","hsl(0,0%,70%)");var background=this._createSVGChild(this._group,"circle");background.setAttribute("r",1);background.setAttribute("fill","hsl(0,0%,92%)");this._foregroundElement=root.createChild("div","pie-chart-foreground");if(showTotal)
  7188. this._totalElement=this._foregroundElement.createChild("div","pie-chart-total");this._formatter=formatter;this._slices=[];this._lastAngle=-Math.PI/2;this._setSize(size);}
  7189. WebInspector.PieChart._ShadowSizePercent=0.02;WebInspector.PieChart.prototype={setTotal:function(totalValue)
  7190. {for(var i=0;i<this._slices.length;++i)
  7191. this._slices[i].remove();this._slices=[];this._totalValue=totalValue;var totalString;if(totalValue)
  7192. totalString=this._formatter?this._formatter(totalValue):totalValue;else
  7193. totalString="";if(this._totalElement)
  7194. this._totalElement.textContent=totalString;},_setSize:function(value)
  7195. {this._group.setAttribute("transform","scale("+(value/2)+") translate("+(1+WebInspector.PieChart._ShadowSizePercent)+",1)");var size=value+"px";this.element.style.width=size;this.element.style.height=size;},addSlice:function(value,color)
  7196. {var sliceAngle=value/this._totalValue*2*Math.PI;if(!isFinite(sliceAngle))
  7197. return;sliceAngle=Math.min(sliceAngle,2*Math.PI*0.9999);var path=this._createSVGChild(this._group,"path");var x1=Math.cos(this._lastAngle);var y1=Math.sin(this._lastAngle);this._lastAngle+=sliceAngle;var x2=Math.cos(this._lastAngle);var y2=Math.sin(this._lastAngle);var largeArc=sliceAngle>Math.PI?1:0;path.setAttribute("d","M0,0 L"+x1+","+y1+" A1,1,0,"+largeArc+",1,"+x2+","+y2+" Z");path.setAttribute("fill",color);this._slices.push(path);},_createSVGChild:function(parent,childType)
  7198. {var child=parent.ownerDocument.createElementNS("http://www.w3.org/2000/svg",childType);parent.appendChild(child);return child;}};WebInspector.Popover=function(popoverHelper)
  7199. {WebInspector.View.call(this);this.markAsRoot();this.element.className=WebInspector.Popover._classNamePrefix;WebInspector.installComponentRootStyles(this.element);this._containerElement=createElementWithClass("div","fill popover-container");this._popupArrowElement=this.element.createChild("div","arrow");this._contentDiv=this.element.createChild("div","content");this._popoverHelper=popoverHelper;this._hideBound=this.hide.bind(this);}
  7200. WebInspector.Popover._classNamePrefix="popover custom-popup-vertical-scroll custom-popup-horizontal-scroll";WebInspector.Popover.prototype={showForAnchor:function(element,anchor,preferredWidth,preferredHeight,arrowDirection)
  7201. {this._innerShow(null,element,anchor,preferredWidth,preferredHeight,arrowDirection);},showView:function(view,anchor,preferredWidth,preferredHeight)
  7202. {this._innerShow(view,view.element,anchor,preferredWidth,preferredHeight);},_innerShow:function(view,contentElement,anchor,preferredWidth,preferredHeight,arrowDirection)
  7203. {if(this._disposed)
  7204. return;this._contentElement=contentElement;if(WebInspector.Popover._popover)
  7205. WebInspector.Popover._popover.hide();WebInspector.Popover._popover=this;var document=anchor instanceof Element?anchor.ownerDocument:contentElement.ownerDocument;var window=document.defaultView;var preferredSize=view?view.measurePreferredSize():WebInspector.measurePreferredSize(this._contentElement);preferredWidth=preferredWidth||preferredSize.width;preferredHeight=preferredHeight||preferredSize.height;window.addEventListener("resize",this._hideBound,false);document.body.appendChild(this._containerElement);WebInspector.View.prototype.show.call(this,this._containerElement);if(view)
  7206. view.show(this._contentDiv);else
  7207. this._contentDiv.appendChild(this._contentElement);this._positionElement(anchor,preferredWidth,preferredHeight,arrowDirection);if(this._popoverHelper){this._contentDiv.addEventListener("mousemove",this._popoverHelper._killHidePopoverTimer.bind(this._popoverHelper),true);this.element.addEventListener("mouseout",this._popoverHelper._popoverMouseOut.bind(this._popoverHelper),true);}},hide:function()
  7208. {this._containerElement.ownerDocument.defaultView.removeEventListener("resize",this._hideBound,false);this.detach();this._containerElement.remove();delete WebInspector.Popover._popover;},get disposed()
  7209. {return this._disposed;},dispose:function()
  7210. {if(this.isShowing())
  7211. this.hide();this._disposed=true;},setCanShrink:function(canShrink)
  7212. {this._hasFixedHeight=!canShrink;this._contentDiv.classList.toggle("fixed-height",this._hasFixedHeight);},_positionElement:function(anchorElement,preferredWidth,preferredHeight,arrowDirection)
  7213. {const borderWidth=25;const scrollerWidth=this._hasFixedHeight?0:11;const arrowHeight=15;const arrowOffset=10;const borderRadius=10;preferredWidth=Math.max(preferredWidth,50);const container=WebInspector.Dialog.modalHostView().element;const totalWidth=container.offsetWidth;const totalHeight=container.offsetHeight;var anchorBox=anchorElement instanceof AnchorBox?anchorElement:anchorElement.boxInWindow(window);anchorBox=anchorBox.relativeToElement(container);var newElementPosition={x:0,y:0,width:preferredWidth+scrollerWidth,height:preferredHeight};var verticalAlignment;var roomAbove=anchorBox.y;var roomBelow=totalHeight-anchorBox.y-anchorBox.height;if((roomAbove>roomBelow)||(arrowDirection===WebInspector.Popover.Orientation.Bottom)){if((anchorBox.y>newElementPosition.height+arrowHeight+borderRadius)||(arrowDirection===WebInspector.Popover.Orientation.Bottom))
  7214. newElementPosition.y=anchorBox.y-newElementPosition.height-arrowHeight;else{newElementPosition.y=borderRadius;newElementPosition.height=anchorBox.y-borderRadius*2-arrowHeight;if(this._hasFixedHeight&&newElementPosition.height<preferredHeight){newElementPosition.y=borderRadius;newElementPosition.height=preferredHeight;}}
  7215. verticalAlignment=WebInspector.Popover.Orientation.Bottom;}else{newElementPosition.y=anchorBox.y+anchorBox.height+arrowHeight;if((newElementPosition.y+newElementPosition.height+borderRadius>=totalHeight)&&(arrowDirection!==WebInspector.Popover.Orientation.Top)){newElementPosition.height=totalHeight-borderRadius-newElementPosition.y;if(this._hasFixedHeight&&newElementPosition.height<preferredHeight){newElementPosition.y=totalHeight-preferredHeight-borderRadius;newElementPosition.height=preferredHeight;}}
  7216. verticalAlignment=WebInspector.Popover.Orientation.Top;}
  7217. var horizontalAlignment;if(anchorBox.x+newElementPosition.width<totalWidth){newElementPosition.x=Math.max(borderRadius,anchorBox.x-borderRadius-arrowOffset);horizontalAlignment="left";}else if(newElementPosition.width+borderRadius*2<totalWidth){newElementPosition.x=totalWidth-newElementPosition.width-borderRadius;horizontalAlignment="right";var arrowRightPosition=Math.max(0,totalWidth-anchorBox.x-anchorBox.width-borderRadius-arrowOffset);arrowRightPosition+=anchorBox.width/2;arrowRightPosition=Math.min(arrowRightPosition,newElementPosition.width-borderRadius-arrowOffset);this._popupArrowElement.style.right=arrowRightPosition+"px";}else{newElementPosition.x=borderRadius;newElementPosition.width=totalWidth-borderRadius*2;newElementPosition.height+=scrollerWidth;horizontalAlignment="left";if(verticalAlignment===WebInspector.Popover.Orientation.Bottom)
  7218. newElementPosition.y-=scrollerWidth;this._popupArrowElement.style.left=Math.max(0,anchorBox.x-borderRadius*2-arrowOffset)+"px";this._popupArrowElement.style.left+=anchorBox.width/2;}
  7219. this.element.className=WebInspector.Popover._classNamePrefix+" "+verticalAlignment+"-"+horizontalAlignment+"-arrow";WebInspector.installComponentRootStyles(this.element);this.element.positionAt(newElementPosition.x-borderWidth,newElementPosition.y-borderWidth,container);this.element.style.width=newElementPosition.width+borderWidth*2+"px";this.element.style.height=newElementPosition.height+borderWidth*2+"px";},__proto__:WebInspector.View.prototype}
  7220. WebInspector.PopoverHelper=function(panelElement,getAnchor,showPopover,onHide,disableOnClick)
  7221. {this._panelElement=panelElement;this._getAnchor=getAnchor;this._showPopover=showPopover;this._onHide=onHide;this._disableOnClick=!!disableOnClick;panelElement.addEventListener("mousedown",this._mouseDown.bind(this),false);panelElement.addEventListener("mousemove",this._mouseMove.bind(this),false);panelElement.addEventListener("mouseout",this._mouseOut.bind(this),false);this.setTimeout(1000,500);}
  7222. WebInspector.PopoverHelper.prototype={setTimeout:function(timeout,hideTimeout)
  7223. {this._timeout=timeout;if(typeof hideTimeout==="number")
  7224. this._hideTimeout=hideTimeout;else
  7225. this._hideTimeout=timeout/2;},_eventInHoverElement:function(event)
  7226. {if(!this._hoverElement)
  7227. return false;var box=this._hoverElement instanceof AnchorBox?this._hoverElement:this._hoverElement.boxInWindow();return(box.x<=event.clientX&&event.clientX<=box.x+box.width&&box.y<=event.clientY&&event.clientY<=box.y+box.height);},_mouseDown:function(event)
  7228. {if(this._disableOnClick||!this._eventInHoverElement(event))
  7229. this.hidePopover();else{this._killHidePopoverTimer();this._handleMouseAction(event,true);}},_mouseMove:function(event)
  7230. {if(this._eventInHoverElement(event))
  7231. return;this._startHidePopoverTimer();this._handleMouseAction(event,false);},_popoverMouseOut:function(event)
  7232. {if(!this.isPopoverVisible())
  7233. return;if(event.relatedTarget&&!event.relatedTarget.isSelfOrDescendant(this._popover._contentDiv))
  7234. this._startHidePopoverTimer();},_mouseOut:function(event)
  7235. {if(!this.isPopoverVisible())
  7236. return;if(!this._eventInHoverElement(event))
  7237. this._startHidePopoverTimer();},_startHidePopoverTimer:function()
  7238. {if(!this._popover||this._hidePopoverTimer)
  7239. return;function doHide()
  7240. {this._hidePopover();delete this._hidePopoverTimer;}
  7241. this._hidePopoverTimer=setTimeout(doHide.bind(this),this._hideTimeout);},_handleMouseAction:function(event,isMouseDown)
  7242. {this._resetHoverTimer();if(event.which&&this._disableOnClick)
  7243. return;this._hoverElement=this._getAnchor(event.target,event);if(!this._hoverElement)
  7244. return;const toolTipDelay=isMouseDown?0:(this._popup?this._timeout*0.6:this._timeout);this._hoverTimer=setTimeout(this._mouseHover.bind(this,this._hoverElement),toolTipDelay);},_resetHoverTimer:function()
  7245. {if(this._hoverTimer){clearTimeout(this._hoverTimer);delete this._hoverTimer;}},isHoverTimerActive:function()
  7246. {return!!this._hoverTimer;},isPopoverVisible:function()
  7247. {return!!this._popover;},hidePopover:function()
  7248. {this._resetHoverTimer();this._hidePopover();},_hidePopover:function()
  7249. {if(!this._popover)
  7250. return;if(this._onHide)
  7251. this._onHide();this._popover.dispose();delete this._popover;this._hoverElement=null;},_mouseHover:function(element)
  7252. {delete this._hoverTimer;this._hidePopover();this._popover=new WebInspector.Popover(this);this._showPopover(element,this._popover);},_killHidePopoverTimer:function()
  7253. {if(this._hidePopoverTimer){clearTimeout(this._hidePopoverTimer);delete this._hidePopoverTimer;this._resetHoverTimer();}}}
  7254. WebInspector.Popover.Orientation={Top:"top",Bottom:"bottom"};WebInspector.ProgressIndicator=function()
  7255. {this.element=createElementWithClass("div","progress-indicator")
  7256. this._shadowRoot=this.element.createShadowRoot();this._shadowRoot.appendChild(WebInspector.View.createStyleElement("ui/progressIndicator.css"));this._contentElement=this._shadowRoot.createChild("div","progress-indicator-shadow-container");this._labelElement=this._contentElement.createChild("div");this._progressElement=this._contentElement.createChild("progress");this._stopButton=this._contentElement.createChild("button","progress-indicator-shadow-stop-button");this._stopButton.addEventListener("click",this.cancel.bind(this));this._isCanceled=false;this._worked=0;}
  7257. WebInspector.ProgressIndicator.prototype={show:function(parent)
  7258. {parent.appendChild(this.element);},done:function()
  7259. {if(this._isDone)
  7260. return;this._isDone=true;this.element.remove();this.dispatchEventToListeners(WebInspector.Progress.Events.Done);},cancel:function()
  7261. {this._isCanceled=true;this.dispatchEventToListeners(WebInspector.Progress.Events.Canceled);},isCanceled:function()
  7262. {return this._isCanceled;},setTitle:function(title)
  7263. {this._labelElement.textContent=title;},setTotalWork:function(totalWork)
  7264. {this._progressElement.max=totalWork;},setWorked:function(worked,title)
  7265. {this._worked=worked;this._progressElement.value=worked;if(title)
  7266. this.setTitle(title);},worked:function(worked)
  7267. {this.setWorked(this._worked+(worked||1));},hideStopButton:function()
  7268. {this._stopButton.classList.add("hidden");},__proto__:WebInspector.Object.prototype};WebInspector.ResizerWidget=function()
  7269. {WebInspector.Object.call(this);this._isEnabled=true;this._isVertical=true;this._elements=[];this._installDragOnMouseDownBound=this._installDragOnMouseDown.bind(this);};WebInspector.ResizerWidget.Events={ResizeStart:"ResizeStart",ResizeUpdate:"ResizeUpdate",ResizeEnd:"ResizeEnd"};WebInspector.ResizerWidget.prototype={isEnabled:function()
  7270. {return this._isEnabled;},setEnabled:function(enabled)
  7271. {this._isEnabled=enabled;this._updateElementCursors();},isVertical:function()
  7272. {return this._isVertical;},setVertical:function(vertical)
  7273. {this._isVertical=vertical;this._updateElementCursors();},elements:function()
  7274. {return this._elements.slice();},addElement:function(element)
  7275. {if(this._elements.indexOf(element)!==-1)
  7276. return;this._elements.push(element);element.addEventListener("mousedown",this._installDragOnMouseDownBound,false);this._updateElementCursor(element);},removeElement:function(element)
  7277. {if(this._elements.indexOf(element)===-1)
  7278. return;this._elements.remove(element);element.removeEventListener("mousedown",this._installDragOnMouseDownBound,false);element.style.removeProperty("cursor");},_updateElementCursors:function()
  7279. {this._elements.forEach(this._updateElementCursor.bind(this));},_updateElementCursor:function(element)
  7280. {if(this._isEnabled)
  7281. element.style.setProperty("cursor",this._isVertical?"ns-resize":"ew-resize");else
  7282. element.style.removeProperty("cursor");},_installDragOnMouseDown:function(event)
  7283. {if(this._elements.indexOf(event.target)===-1)
  7284. return false;WebInspector.elementDragStart(this._dragStart.bind(this),this._drag.bind(this),this._dragEnd.bind(this),this._isVertical?"ns-resize":"ew-resize",event);},_dragStart:function(event)
  7285. {if(!this._isEnabled)
  7286. return false;this._startPosition=this._isVertical?event.pageY:event.pageX;this.dispatchEventToListeners(WebInspector.ResizerWidget.Events.ResizeStart,{startPosition:this._startPosition,currentPosition:this._startPosition});return true;},_drag:function(event)
  7287. {if(!this._isEnabled){this._dragEnd(event);return true;}
  7288. var position=this._isVertical?event.pageY:event.pageX;this.dispatchEventToListeners(WebInspector.ResizerWidget.Events.ResizeUpdate,{startPosition:this._startPosition,currentPosition:position,shiftKey:event.shiftKey});event.preventDefault();return false;},_dragEnd:function(event)
  7289. {this.dispatchEventToListeners(WebInspector.ResizerWidget.Events.ResizeEnd);delete this._startPosition;},__proto__:WebInspector.Object.prototype};;WebInspector.RootView=function()
  7290. {WebInspector.VBox.call(this);this.markAsRoot();this.element.classList.add("root-view");this.element.setAttribute("spellcheck",false);}
  7291. WebInspector.RootView.prototype={attachToDocument:function(document)
  7292. {document.defaultView.addEventListener("resize",this.doResize.bind(this),false);this._window=document.defaultView;this.doResize();this.show(document.body);},doResize:function()
  7293. {if(this._window){var size=this.constraints().minimum;var zoom=WebInspector.zoomManager.zoomFactor();var right=Math.min(0,this._window.innerWidth-size.width/zoom);this.element.style.marginRight=right+"px";var bottom=Math.min(0,this._window.innerHeight-size.height/zoom);this.element.style.marginBottom=bottom+"px";}
  7294. WebInspector.VBox.prototype.doResize.call(this);},__proto__:WebInspector.VBox.prototype};WebInspector.SearchableView=function(searchable,settingName)
  7295. {WebInspector.VBox.call(this,true);this.registerRequiredCSS("ui/searchableView.css");this._searchProvider=searchable;this._settingName=settingName;this.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this.contentElement.createChild("content");this._footerElementContainer=this.contentElement.createChild("div","search-bar hidden");this._footerElementContainer.style.order=100;var toolbar=new WebInspector.StatusBar(this._footerElementContainer);toolbar.makeNarrow();if(this._searchProvider.supportsCaseSensitiveSearch()){this._caseSensitiveButton=new WebInspector.StatusBarTextButton(WebInspector.UIString("Case sensitive"),"case-sensitive-search-status-bar-item","Aa",2);this._caseSensitiveButton.addEventListener("click",this._toggleCaseSensitiveSearch,this);toolbar.appendStatusBarItem(this._caseSensitiveButton);}
  7296. if(this._searchProvider.supportsRegexSearch()){this._regexButton=new WebInspector.StatusBarTextButton(WebInspector.UIString("Regex"),"regex-search-status-bar-item",".*",2);this._regexButton.addEventListener("click",this._toggleRegexSearch,this);toolbar.appendStatusBarItem(this._regexButton);}
  7297. this._footerElement=this._footerElementContainer.createChild("table","toolbar-search");this._footerElement.cellSpacing=0;this._firstRowElement=this._footerElement.createChild("tr");this._secondRowElement=this._footerElement.createChild("tr","hidden");var searchControlElementColumn=this._firstRowElement.createChild("td");this._searchControlElement=searchControlElementColumn.createChild("span","toolbar-search-control");this._searchInputElement=this._searchControlElement.createChild("input","search-replace");this._searchInputElement.id="search-input-field";this._searchInputElement.placeholder=WebInspector.UIString("Find");this._matchesElement=this._searchControlElement.createChild("label","search-results-matches");this._matchesElement.setAttribute("for","search-input-field");this._searchNavigationElement=this._searchControlElement.createChild("div","toolbar-search-navigation-controls");this._searchNavigationPrevElement=this._searchNavigationElement.createChild("div","toolbar-search-navigation toolbar-search-navigation-prev");this._searchNavigationPrevElement.addEventListener("click",this._onPrevButtonSearch.bind(this),false);this._searchNavigationPrevElement.title=WebInspector.UIString("Search Previous");this._searchNavigationNextElement=this._searchNavigationElement.createChild("div","toolbar-search-navigation toolbar-search-navigation-next");this._searchNavigationNextElement.addEventListener("click",this._onNextButtonSearch.bind(this),false);this._searchNavigationNextElement.title=WebInspector.UIString("Search Next");this._searchInputElement.addEventListener("mousedown",this._onSearchFieldManualFocus.bind(this),false);this._searchInputElement.addEventListener("keydown",this._onSearchKeyDown.bind(this),true);this._searchInputElement.addEventListener("input",this._onInput.bind(this),false);this._replaceInputElement=this._secondRowElement.createChild("td").createChild("input","search-replace toolbar-replace-control");this._replaceInputElement.addEventListener("keydown",this._onReplaceKeyDown.bind(this),true);this._replaceInputElement.placeholder=WebInspector.UIString("Replace");this._findButtonElement=this._firstRowElement.createChild("td").createChild("button","search-action-button hidden");this._findButtonElement.textContent=WebInspector.UIString("Find");this._findButtonElement.tabIndex=-1;this._findButtonElement.addEventListener("click",this._onFindClick.bind(this),false);this._replaceButtonElement=this._secondRowElement.createChild("td").createChild("button","search-action-button");this._replaceButtonElement.textContent=WebInspector.UIString("Replace");this._replaceButtonElement.disabled=true;this._replaceButtonElement.tabIndex=-1;this._replaceButtonElement.addEventListener("click",this._replace.bind(this),false);this._prevButtonElement=this._firstRowElement.createChild("td").createChild("button","search-action-button hidden");this._prevButtonElement.textContent=WebInspector.UIString("Previous");this._prevButtonElement.tabIndex=-1;this._prevButtonElement.addEventListener("click",this._onPreviousClick.bind(this),false);this._replaceAllButtonElement=this._secondRowElement.createChild("td").createChild("button","search-action-button");this._replaceAllButtonElement.textContent=WebInspector.UIString("Replace All");this._replaceAllButtonElement.addEventListener("click",this._replaceAll.bind(this),false);this._replaceElement=this._firstRowElement.createChild("td").createChild("span");this._replaceLabelElement=createCheckboxLabel(WebInspector.UIString("Replace"));this._replaceCheckboxElement=this._replaceLabelElement.checkboxElement;this._uniqueId=++WebInspector.SearchableView._lastUniqueId;var replaceCheckboxId="search-replace-trigger"+this._uniqueId;this._replaceCheckboxElement.id=replaceCheckboxId;this._replaceCheckboxElement.addEventListener("change",this._updateSecondRowVisibility.bind(this),false);this._replaceElement.appendChild(this._replaceLabelElement);var cancelButtonElement=this._firstRowElement.createChild("td").createChild("button","search-action-button");cancelButtonElement.textContent=WebInspector.UIString("Cancel");cancelButtonElement.tabIndex=-1;cancelButtonElement.addEventListener("click",this.closeSearch.bind(this),false);this._minimalSearchQuerySize=3;this._registerShortcuts();this._loadSetting();}
  7298. WebInspector.SearchableView._lastUniqueId=0;WebInspector.SearchableView.findShortcuts=function()
  7299. {if(WebInspector.SearchableView._findShortcuts)
  7300. return WebInspector.SearchableView._findShortcuts;WebInspector.SearchableView._findShortcuts=[WebInspector.KeyboardShortcut.makeDescriptor("f",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)];if(!WebInspector.isMac())
  7301. WebInspector.SearchableView._findShortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F3));return WebInspector.SearchableView._findShortcuts;}
  7302. WebInspector.SearchableView.cancelSearchShortcuts=function()
  7303. {if(WebInspector.SearchableView._cancelSearchShortcuts)
  7304. return WebInspector.SearchableView._cancelSearchShortcuts;WebInspector.SearchableView._cancelSearchShortcuts=[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Esc)];return WebInspector.SearchableView._cancelSearchShortcuts;}
  7305. WebInspector.SearchableView.findNextShortcut=function()
  7306. {if(WebInspector.SearchableView._findNextShortcut)
  7307. return WebInspector.SearchableView._findNextShortcut;WebInspector.SearchableView._findNextShortcut=[];if(WebInspector.isMac())
  7308. WebInspector.SearchableView._findNextShortcut.push(WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.Meta));return WebInspector.SearchableView._findNextShortcut;}
  7309. WebInspector.SearchableView.findPreviousShortcuts=function()
  7310. {if(WebInspector.SearchableView._findPreviousShortcuts)
  7311. return WebInspector.SearchableView._findPreviousShortcuts;WebInspector.SearchableView._findPreviousShortcuts=[];if(WebInspector.isMac())
  7312. WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.Meta|WebInspector.KeyboardShortcut.Modifiers.Shift));return WebInspector.SearchableView._findPreviousShortcuts;}
  7313. WebInspector.SearchableView.prototype={_toggleCaseSensitiveSearch:function()
  7314. {this._caseSensitiveButton.setToggled(!this._caseSensitiveButton.toggled());this._saveSetting();this._performSearch(false,true);},_toggleRegexSearch:function()
  7315. {this._regexButton.setToggled(!this._regexButton.toggled());this._saveSetting();this._performSearch(false,true);},_setting:function()
  7316. {if(!this._settingName)
  7317. return null;if(!WebInspector.settings[this._settingName])
  7318. WebInspector.settings[this._settingName]=WebInspector.settings.createSetting(this._settingName,{});return WebInspector.settings[this._settingName];},_saveSetting:function()
  7319. {var setting=this._setting();if(!setting)
  7320. return;var settingValue=setting.get()||{};settingValue.caseSensitive=this._caseSensitiveButton.toggled();settingValue.isRegex=this._regexButton.toggled();setting.set(settingValue);},_loadSetting:function()
  7321. {var settingValue=this._setting()?(this._setting().get()||{}):{};if(this._searchProvider.supportsCaseSensitiveSearch())
  7322. this._caseSensitiveButton.setToggled(!!settingValue.caseSensitive);if(this._searchProvider.supportsRegexSearch())
  7323. this._regexButton.setToggled(!!settingValue.isRegex);},defaultFocusedElement:function()
  7324. {var children=this.children();for(var i=0;i<children.length;++i){var element=children[i].defaultFocusedElement();if(element)
  7325. return element;}
  7326. return WebInspector.View.prototype.defaultFocusedElement.call(this);},_onKeyDown:function(event)
  7327. {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent((event));var handler=this._shortcuts[shortcutKey];if(handler&&handler(event))
  7328. event.consume(true);},_registerShortcuts:function()
  7329. {this._shortcuts={};function register(shortcuts,handler)
  7330. {for(var i=0;i<shortcuts.length;++i)
  7331. this._shortcuts[shortcuts[i].key]=handler;}
  7332. register.call(this,WebInspector.SearchableView.findShortcuts(),this.handleFindShortcut.bind(this));register.call(this,WebInspector.SearchableView.cancelSearchShortcuts(),this.handleCancelSearchShortcut.bind(this));register.call(this,WebInspector.SearchableView.findNextShortcut(),this.handleFindNextShortcut.bind(this));register.call(this,WebInspector.SearchableView.findPreviousShortcuts(),this.handleFindPreviousShortcut.bind(this));},setMinimalSearchQuerySize:function(minimalSearchQuerySize)
  7333. {this._minimalSearchQuerySize=minimalSearchQuerySize;},setReplaceable:function(replaceable)
  7334. {this._replaceable=replaceable;},updateSearchMatchesCount:function(matches)
  7335. {this._searchProvider.currentSearchMatches=matches;this._updateSearchMatchesCountAndCurrentMatchIndex(this._searchProvider.currentQuery?matches:0,-1);},updateCurrentMatchIndex:function(currentMatchIndex)
  7336. {this._updateSearchMatchesCountAndCurrentMatchIndex(this._searchProvider.currentSearchMatches,currentMatchIndex);},isSearchVisible:function()
  7337. {return this._searchIsVisible;},closeSearch:function()
  7338. {this.cancelSearch();if(WebInspector.currentFocusElement()&&WebInspector.currentFocusElement().isDescendant(this._footerElementContainer))
  7339. this.focus();},_toggleSearchBar:function(toggled)
  7340. {this._footerElementContainer.classList.toggle("hidden",!toggled);this.doResize();},cancelSearch:function()
  7341. {if(!this._searchIsVisible)
  7342. return;this.resetSearch();delete this._searchIsVisible;this._toggleSearchBar(false);},resetSearch:function()
  7343. {this._clearSearch();this._updateReplaceVisibility();this._matchesElement.textContent="";},refreshSearch:function()
  7344. {if(!this._searchIsVisible)
  7345. return;this.resetSearch();this._performSearch(false,false);},handleFindNextShortcut:function()
  7346. {if(!this._searchIsVisible)
  7347. return false;this._searchProvider.jumpToNextSearchResult();return true;},handleFindPreviousShortcut:function()
  7348. {if(!this._searchIsVisible)
  7349. return false;this._searchProvider.jumpToPreviousSearchResult();return true;},handleFindShortcut:function()
  7350. {this.showSearchField();return true;},handleCancelSearchShortcut:function()
  7351. {if(!this._searchIsVisible)
  7352. return false;this.closeSearch();return true;},_updateSearchNavigationButtonState:function(enabled)
  7353. {this._replaceButtonElement.disabled=!enabled;if(enabled){this._searchNavigationPrevElement.classList.add("enabled");this._searchNavigationNextElement.classList.add("enabled");}else{this._searchNavigationPrevElement.classList.remove("enabled");this._searchNavigationNextElement.classList.remove("enabled");}},_updateSearchMatchesCountAndCurrentMatchIndex:function(matches,currentMatchIndex)
  7354. {if(!this._currentQuery)
  7355. this._matchesElement.textContent="";else if(matches===0||currentMatchIndex>=0)
  7356. this._matchesElement.textContent=WebInspector.UIString("%d of %d",currentMatchIndex+1,matches);else if(matches===1)
  7357. this._matchesElement.textContent=WebInspector.UIString("1 match");else
  7358. this._matchesElement.textContent=WebInspector.UIString("%d matches",matches);this._updateSearchNavigationButtonState(matches>0);},showSearchField:function()
  7359. {if(this._searchIsVisible)
  7360. this.cancelSearch();var queryCandidate;if(WebInspector.currentFocusElement()!==this._searchInputElement){var selection=this._searchInputElement.window().getSelection();if(selection.rangeCount)
  7361. queryCandidate=selection.toString().replace(/\r?\n.*/,"");}
  7362. this._toggleSearchBar(true);this._updateReplaceVisibility();if(queryCandidate)
  7363. this._searchInputElement.value=queryCandidate;this._performSearch(false,false);this._searchInputElement.focus();this._searchInputElement.select();this._searchIsVisible=true;},_updateReplaceVisibility:function()
  7364. {this._replaceElement.classList.toggle("hidden",!this._replaceable);if(!this._replaceable){this._replaceCheckboxElement.checked=false;this._updateSecondRowVisibility();}},_onSearchFieldManualFocus:function(event)
  7365. {WebInspector.setCurrentFocusElement((event.target));},_onSearchKeyDown:function(event)
  7366. {if(!isEnterKey(event))
  7367. return;if(!this._currentQuery)
  7368. this._performSearch(true,true,event.shiftKey);else
  7369. this._jumpToNextSearchResult(event.shiftKey);},_onReplaceKeyDown:function(event)
  7370. {if(isEnterKey(event))
  7371. this._replace();},_jumpToNextSearchResult:function(isBackwardSearch)
  7372. {if(!this._currentQuery||!this._searchNavigationPrevElement.classList.contains("enabled"))
  7373. return;if(isBackwardSearch)
  7374. this._searchProvider.jumpToPreviousSearchResult();else
  7375. this._searchProvider.jumpToNextSearchResult();},_onNextButtonSearch:function(event)
  7376. {if(!this._searchNavigationNextElement.classList.contains("enabled"))
  7377. return;this._jumpToNextSearchResult();this._searchInputElement.focus();},_onPrevButtonSearch:function(event)
  7378. {if(!this._searchNavigationPrevElement.classList.contains("enabled"))
  7379. return;this._jumpToNextSearchResult(true);this._searchInputElement.focus();},_onFindClick:function(event)
  7380. {if(!this._currentQuery)
  7381. this._performSearch(true,true);else
  7382. this._jumpToNextSearchResult();this._searchInputElement.focus();},_onPreviousClick:function(event)
  7383. {if(!this._currentQuery)
  7384. this._performSearch(true,true,true);else
  7385. this._jumpToNextSearchResult(true);this._searchInputElement.focus();},_clearSearch:function()
  7386. {delete this._currentQuery;if(!!this._searchProvider.currentQuery){delete this._searchProvider.currentQuery;this._searchProvider.searchCanceled();}
  7387. this._updateSearchMatchesCountAndCurrentMatchIndex(0,-1);},_performSearch:function(forceSearch,shouldJump,jumpBackwards)
  7388. {var query=this._searchInputElement.value;if(!query||(!forceSearch&&query.length<this._minimalSearchQuerySize&&!this._currentQuery)){this._clearSearch();return;}
  7389. this._currentQuery=query;this._searchProvider.currentQuery=query;var searchConfig=this._currentSearchConfig();this._searchProvider.performSearch(searchConfig,shouldJump,jumpBackwards);},_currentSearchConfig:function()
  7390. {var query=this._searchInputElement.value;var caseSensitive=this._caseSensitiveButton?this._caseSensitiveButton.toggled():false;var isRegex=this._regexButton?this._regexButton.toggled():false;return new WebInspector.SearchableView.SearchConfig(query,caseSensitive,isRegex);},_updateSecondRowVisibility:function()
  7391. {var secondRowVisible=this._replaceCheckboxElement.checked;this._footerElementContainer.classList.toggle("replaceable",secondRowVisible);this._footerElement.classList.toggle("toolbar-search-replace",secondRowVisible);this._secondRowElement.classList.toggle("hidden",!secondRowVisible);this._prevButtonElement.classList.toggle("hidden",!secondRowVisible);this._findButtonElement.classList.toggle("hidden",!secondRowVisible);this._replaceCheckboxElement.tabIndex=secondRowVisible?-1:0;if(secondRowVisible)
  7392. this._replaceInputElement.focus();else
  7393. this._searchInputElement.focus();this.doResize();},_replace:function()
  7394. {var searchConfig=this._currentSearchConfig();(this._searchProvider).replaceSelectionWith(searchConfig,this._replaceInputElement.value);delete this._currentQuery;this._performSearch(true,true);},_replaceAll:function()
  7395. {var searchConfig=this._currentSearchConfig();(this._searchProvider).replaceAllWith(searchConfig,this._replaceInputElement.value);},_onInput:function(event)
  7396. {this._onValueChanged();},_onValueChanged:function()
  7397. {this._performSearch(false,true);},__proto__:WebInspector.VBox.prototype}
  7398. WebInspector.Searchable=function()
  7399. {}
  7400. WebInspector.Searchable.prototype={searchCanceled:function(){},performSearch:function(searchConfig,shouldJump,jumpBackwards){},jumpToNextSearchResult:function(){},jumpToPreviousSearchResult:function(){},supportsCaseSensitiveSearch:function(){},supportsRegexSearch:function(){}}
  7401. WebInspector.Replaceable=function()
  7402. {}
  7403. WebInspector.Replaceable.prototype={replaceSelectionWith:function(searchConfig,replacement){},replaceAllWith:function(searchConfig,replacement){}}
  7404. WebInspector.SearchableView.SearchConfig=function(query,caseSensitive,isRegex)
  7405. {this.query=query;this.caseSensitive=caseSensitive;this.isRegex=isRegex;};WebInspector.Section=function(title,subtitle)
  7406. {this.element=createElement("div");this.element.className="section";this.element._section=this;this.headerElement=createElement("div");this.headerElement.className="header";this.titleElement=createElement("div");this.titleElement.className="title";this.subtitleElement=createElement("div");this.subtitleElement.className="subtitle";this.headerElement.appendChild(this.subtitleElement);this.headerElement.appendChild(this.titleElement);this.headerElement.addEventListener("click",this.handleClick.bind(this),false);this.element.appendChild(this.headerElement);this.title=title;if(subtitle){this._subtitle=subtitle;this.subtitleElement.textContent=subtitle;}
  7407. this._expanded=false;this.headerElement.classList.add("monospace");this.propertiesElement=createElement("ol");this.propertiesElement.className="properties properties-tree monospace";this.propertiesTreeOutline=new TreeOutline(this.propertiesElement,true);this.propertiesTreeOutline.setFocusable(false);this.propertiesTreeOutline.section=this;this.element.appendChild(this.propertiesElement);}
  7408. WebInspector.Section.prototype={get title()
  7409. {return this._title;},set title(x)
  7410. {if(this._title===x)
  7411. return;this._title=x;if(x instanceof Node){this.titleElement.removeChildren();this.titleElement.appendChild(x);}else
  7412. this.titleElement.textContent=x;},get subtitle()
  7413. {return this._subtitle;},get subtitleAsTextForTest()
  7414. {var result=this.subtitleElement.textContent;var child=this.subtitleElement.querySelector("[data-uncopyable]");if(child){var linkData=child.getAttribute("data-uncopyable");if(linkData)
  7415. result+=linkData;}
  7416. return result;},get expanded()
  7417. {return this._expanded;},repopulate:function()
  7418. {this._populated=false;if(this._expanded){this.onpopulate();this._populated=true;}},onpopulate:function()
  7419. {},expand:function()
  7420. {if(this._expanded)
  7421. return;this._expanded=true;this.element.classList.add("expanded");if(!this._populated){this.onpopulate();this._populated=true;}},collapse:function()
  7422. {if(!this._expanded)
  7423. return;this._expanded=false;this.element.classList.remove("expanded");},handleClick:function(event)
  7424. {if(this._expanded)
  7425. this.collapse();else
  7426. this.expand();event.consume();}};WebInspector.SettingsUI={}
  7427. WebInspector.SettingsUI.createSettingCheckbox=function(name,setting,omitParagraphElement,tooltip)
  7428. {var label=createCheckboxLabel(name);if(tooltip)
  7429. label.title=tooltip;var input=label.checkboxElement;input.name=name;WebInspector.SettingsUI.bindCheckbox(input,setting);if(omitParagraphElement)
  7430. return label;var p=createElement("p");p.appendChild(label);return p;}
  7431. WebInspector.SettingsUI.bindCheckbox=function(input,setting)
  7432. {function settingChanged()
  7433. {if(input.checked!==setting.get())
  7434. input.checked=setting.get();}
  7435. setting.addChangeListener(settingChanged);settingChanged();function inputChanged()
  7436. {if(setting.get()!==input.checked)
  7437. setting.set(input.checked);}
  7438. input.addEventListener("change",inputChanged,false);}
  7439. WebInspector.SettingsUI.createSettingInputField=function(label,setting,numeric,maxLength,width,validatorCallback,instant,clearForZero,placeholder)
  7440. {var p=createElement("p");var labelElement=p.createChild("label");labelElement.textContent=label;var inputElement=p.createChild("input");inputElement.type="text";if(numeric)
  7441. inputElement.className="numeric";if(maxLength)
  7442. inputElement.maxLength=maxLength;if(width)
  7443. inputElement.style.width=width;inputElement.placeholder=placeholder||"";if(validatorCallback||instant){inputElement.addEventListener("change",onInput,false);inputElement.addEventListener("input",onInput,false);}
  7444. inputElement.addEventListener("keydown",onKeyDown,false);var errorMessageLabel;if(validatorCallback)
  7445. errorMessageLabel=p.createChild("div","field-error-message");function onInput()
  7446. {if(validatorCallback)
  7447. validate();if(instant)
  7448. apply();}
  7449. function onKeyDown(event)
  7450. {if(isEnterKey(event))
  7451. apply();incrementForArrows(event);}
  7452. function incrementForArrows(event)
  7453. {if(!numeric)
  7454. return;var increment=event.keyIdentifier==="Up"?1:event.keyIdentifier==="Down"?-1:0;if(!increment)
  7455. return;if(event.shiftKey)
  7456. increment*=10;var value=inputElement.value;if(validatorCallback&&validatorCallback(value))
  7457. return;value=Number(value);if(clearForZero&&!value)
  7458. return;value+=increment;if(clearForZero&&!value)
  7459. return;value=String(value);if(validatorCallback&&validatorCallback(value))
  7460. return;inputElement.value=value;apply();event.preventDefault();}
  7461. function validate()
  7462. {var error=validatorCallback(inputElement.value);if(!error)
  7463. error="";inputElement.classList.toggle("error-input",!!error);errorMessageLabel.textContent=error;}
  7464. if(!instant)
  7465. inputElement.addEventListener("blur",apply,false);function apply()
  7466. {if(validatorCallback&&validatorCallback(inputElement.value))
  7467. return;setting.removeChangeListener(onSettingChange);setting.set(numeric?Number(inputElement.value):inputElement.value);setting.addChangeListener(onSettingChange);}
  7468. setting.addChangeListener(onSettingChange);function onSettingChange()
  7469. {var value=setting.get();if(clearForZero&&!value)
  7470. value="";inputElement.value=value;}
  7471. onSettingChange();if(validatorCallback)
  7472. validate();return p;}
  7473. WebInspector.SettingsUI.createCustomSetting=function(name,element)
  7474. {var p=createElement("p");var fieldsetElement=p.createChild("fieldset");fieldsetElement.createChild("label").textContent=name;fieldsetElement.appendChild(element);return p;}
  7475. WebInspector.SettingsUI.createSettingFieldset=function(setting)
  7476. {var fieldset=createElement("fieldset");fieldset.disabled=!setting.get();setting.addChangeListener(settingChanged);return fieldset;function settingChanged()
  7477. {fieldset.disabled=!setting.get();}}
  7478. WebInspector.SettingsUI.regexValidator=function(text)
  7479. {var regex;try{regex=new RegExp(text);}catch(e){}
  7480. return regex?null:WebInspector.UIString("Invalid pattern");}
  7481. WebInspector.SettingsUI.createInput=function(parentElement,id,defaultText,eventListener,numeric,size)
  7482. {var element=parentElement.createChild("input");element.id=id;element.type="text";element.maxLength=12;element.style.width=size||"80px";element.value=defaultText;element.align="right";if(numeric)
  7483. element.className="numeric";element.addEventListener("input",eventListener,false);element.addEventListener("keydown",keyDownListener,false);function keyDownListener(event)
  7484. {if(isEnterKey(event))
  7485. eventListener(event);}
  7486. return element;}
  7487. WebInspector.UISettingDelegate=function()
  7488. {}
  7489. WebInspector.UISettingDelegate.prototype={settingElement:function()
  7490. {return null;}};WebInspector.SidebarSectionTreeElement=function(title,representedObject,hasChildren)
  7491. {TreeElement.call(this,title.escapeHTML(),representedObject||{},hasChildren);this.expand();}
  7492. WebInspector.SidebarSectionTreeElement.prototype={selectable:false,collapse:function()
  7493. {},get smallChildren()
  7494. {return this._smallChildren;},set smallChildren(x)
  7495. {if(this._smallChildren===x)
  7496. return;this._smallChildren=x;this._childrenListNode.classList.toggle("small",this._smallChildren);},onattach:function()
  7497. {this.listItemElement.classList.add("sidebar-tree-section");},onreveal:function()
  7498. {if(this.listItemElement)
  7499. this.listItemElement.scrollIntoViewIfNeeded(false);},__proto__:TreeElement.prototype}
  7500. WebInspector.SidebarTreeElement=function(className,title,subtitle,representedObject,hasChildren)
  7501. {TreeElement.call(this,"",representedObject,hasChildren);if(hasChildren)
  7502. this.disclosureButton=createElementWithClass("button","disclosure-button");this.iconElement=createElementWithClass("div","icon");this.statusElement=createElementWithClass("div","status");this.titlesElement=createElementWithClass("div","titles");this.titleContainer=this.titlesElement.createChild("span","title-container");this.titleElement=this.titleContainer.createChild("span","title");this.subtitleElement=this.titlesElement.createChild("span","subtitle");this.className=className;this.mainTitle=title;this.subtitle=subtitle;}
  7503. WebInspector.SidebarTreeElement.prototype={get small()
  7504. {return this._small;},set small(x)
  7505. {this._small=x;if(this.listItemElement)
  7506. this.listItemElement.classList.toggle("small",this._small);},get mainTitle()
  7507. {return this._mainTitle;},set mainTitle(x)
  7508. {this._mainTitle=x;this.refreshTitles();},get subtitle()
  7509. {return this._subtitle;},set subtitle(x)
  7510. {this._subtitle=x;this.refreshTitles();},set wait(x)
  7511. {this.listItemElement.classList.toggle("wait",x);},refreshTitles:function()
  7512. {var mainTitle=this.mainTitle;if(this.titleElement.textContent!==mainTitle)
  7513. this.titleElement.textContent=mainTitle;var subtitle=this.subtitle;if(subtitle){if(this.subtitleElement.textContent!==subtitle)
  7514. this.subtitleElement.textContent=subtitle;this.titlesElement.classList.remove("no-subtitle");}else{this.subtitleElement.textContent="";this.titlesElement.classList.add("no-subtitle");}},isEventWithinDisclosureTriangle:function(event)
  7515. {return event.target===this.disclosureButton;},onattach:function()
  7516. {this.listItemElement.classList.add("sidebar-tree-item");if(this.className)
  7517. this.listItemElement.classList.add(this.className);if(this.small)
  7518. this.listItemElement.classList.add("small");if(this.hasChildren&&this.disclosureButton)
  7519. this.listItemElement.appendChild(this.disclosureButton);this.listItemElement.appendChildren(this.iconElement,this.statusElement,this.titlesElement);},onreveal:function()
  7520. {if(this.listItemElement)
  7521. this.listItemElement.scrollIntoViewIfNeeded(false);},__proto__:TreeElement.prototype};WebInspector.ShowMoreDataGridNode=function(callback,startPosition,endPosition,chunkSize)
  7522. {WebInspector.DataGridNode.call(this,{summaryRow:true},false);this._callback=callback;this._startPosition=startPosition;this._endPosition=endPosition;this._chunkSize=chunkSize;this.showNext=createElement("button");this.showNext.setAttribute("type","button");this.showNext.addEventListener("click",this._showNextChunk.bind(this),false);this.showNext.textContent=WebInspector.UIString("Show %d before",this._chunkSize);this.showAll=createElement("button");this.showAll.setAttribute("type","button");this.showAll.addEventListener("click",this._showAll.bind(this),false);this.showLast=createElement("button");this.showLast.setAttribute("type","button");this.showLast.addEventListener("click",this._showLastChunk.bind(this),false);this.showLast.textContent=WebInspector.UIString("Show %d after",this._chunkSize);this._updateLabels();this.selectable=false;}
  7523. WebInspector.ShowMoreDataGridNode.prototype={_showNextChunk:function()
  7524. {this._callback(this._startPosition,this._startPosition+this._chunkSize);},_showAll:function()
  7525. {this._callback(this._startPosition,this._endPosition);},_showLastChunk:function()
  7526. {this._callback(this._endPosition-this._chunkSize,this._endPosition);},_updateLabels:function()
  7527. {var totalSize=this._endPosition-this._startPosition;if(totalSize>this._chunkSize){this.showNext.classList.remove("hidden");this.showLast.classList.remove("hidden");}else{this.showNext.classList.add("hidden");this.showLast.classList.add("hidden");}
  7528. this.showAll.textContent=WebInspector.UIString("Show all %d",totalSize);},createCells:function()
  7529. {this._hasCells=false;WebInspector.DataGridNode.prototype.createCells.call(this);},createCell:function(columnIdentifier)
  7530. {var cell=this.createTD(columnIdentifier);if(!this._hasCells){this._hasCells=true;if(this.depth)
  7531. cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px");cell.appendChild(this.showNext);cell.appendChild(this.showAll);cell.appendChild(this.showLast);}
  7532. return cell;},setStartPosition:function(from)
  7533. {this._startPosition=from;this._updateLabels();},setEndPosition:function(to)
  7534. {this._endPosition=to;this._updateLabels();},nodeSelfHeight:function()
  7535. {return 32;},dispose:function()
  7536. {},__proto__:WebInspector.DataGridNode.prototype};WebInspector.SoftContextMenu=function(items,itemSelectedCallback,parentMenu)
  7537. {this._items=items;this._itemSelectedCallback=itemSelectedCallback;this._parentMenu=parentMenu;}
  7538. WebInspector.SoftContextMenu.prototype={show:function(document,x,y)
  7539. {if(this._contextMenuElement)
  7540. this._discardMenu(true);if(!this._items.length)
  7541. return;this._document=document;this._x=x;this._y=y;this._time=new Date().getTime();this._contextMenuElement=createElementWithClass("div","soft-context-menu");var root=this._contextMenuElement.createShadowRoot();root.appendChild(WebInspector.View.createStyleElement("ui/softContextMenu.css"));var menuElement=root.createChild("div");this._contextMenuElement.tabIndex=0;this._contextMenuElement.style.top=y+"px";this._contextMenuElement.style.left=x+"px";menuElement.addEventListener("mouseup",consumeEvent,false);menuElement.addEventListener("keydown",this._menuKeyDown.bind(this),false);for(var i=0;i<this._items.length;++i)
  7542. menuElement.appendChild(this._createMenuItem(this._items[i]));if(!this._parentMenu){this._glassPaneElement=createElementWithClass("div","soft-context-menu-glass-pane fill");this._glassPaneElement.tabIndex=0;this._glassPaneElement.addEventListener("mouseup",this._glassPaneMouseUp.bind(this),false);this._glassPaneElement.appendChild(this._contextMenuElement);document.body.appendChild(this._glassPaneElement);this._focus();}else{this._parentMenu._parentGlassPaneElement().appendChild(this._contextMenuElement);}
  7543. if(document.body.offsetWidth<this._contextMenuElement.offsetLeft+this._contextMenuElement.offsetWidth)
  7544. this._contextMenuElement.style.left=Math.max(0,x-this._contextMenuElement.offsetWidth)+"px";if(document.body.offsetHeight<this._contextMenuElement.offsetTop+this._contextMenuElement.offsetHeight)
  7545. this._contextMenuElement.style.top=Math.max(0,document.body.offsetHeight-this._contextMenuElement.offsetHeight)+"px";},_parentGlassPaneElement:function()
  7546. {if(this._glassPaneElement)
  7547. return this._glassPaneElement;if(this._parentMenu)
  7548. return this._parentMenu._parentGlassPaneElement();return null;},_createMenuItem:function(item)
  7549. {if(item.type==="separator")
  7550. return this._createSeparator();if(item.type==="subMenu")
  7551. return this._createSubMenu(item);var menuItemElement=createElementWithClass("div","soft-context-menu-item");var checkMarkElement=menuItemElement.createChild("span","soft-context-menu-item-checkmark");checkMarkElement.textContent="\u2713 ";if(!item.checked)
  7552. checkMarkElement.style.opacity="0";menuItemElement.createTextChild(item.label);menuItemElement.addEventListener("mousedown",this._menuItemMouseDown.bind(this),false);menuItemElement.addEventListener("mouseup",this._menuItemMouseUp.bind(this),false);menuItemElement.addEventListener("mouseover",this._menuItemMouseOver.bind(this),false);menuItemElement.addEventListener("mouseleave",this._menuItemMouseLeave.bind(this),false);menuItemElement._actionId=item.id;return menuItemElement;},_createSubMenu:function(item)
  7553. {var menuItemElement=createElementWithClass("div","soft-context-menu-item");menuItemElement._subItems=item.subItems;var checkMarkElement=menuItemElement.createChild("span","soft-context-menu-item-checkmark");checkMarkElement.textContent="\u2713 ";checkMarkElement.style.opacity="0";menuItemElement.createTextChild(item.label);var subMenuArrowElement=menuItemElement.createChild("span","soft-context-menu-item-submenu-arrow");subMenuArrowElement.textContent="\u25B6";menuItemElement.addEventListener("mousedown",this._menuItemMouseDown.bind(this),false);menuItemElement.addEventListener("mouseup",this._menuItemMouseUp.bind(this),false);menuItemElement.addEventListener("mouseover",this._menuItemMouseOver.bind(this),false);menuItemElement.addEventListener("mouseleave",this._menuItemMouseLeave.bind(this),false);return menuItemElement;},_createSeparator:function()
  7554. {var separatorElement=createElementWithClass("div","soft-context-menu-separator");separatorElement._isSeparator=true;separatorElement.addEventListener("mouseover",this._hideSubMenu.bind(this),false);separatorElement.createChild("div","separator-line");return separatorElement;},_menuItemMouseDown:function(event)
  7555. {event.consume(true);},_menuItemMouseUp:function(event)
  7556. {this._triggerAction(event.target,event);event.consume();},_focus:function()
  7557. {this._contextMenuElement.focus();},_triggerAction:function(menuItemElement,event)
  7558. {if(!menuItemElement._subItems){this._discardMenu(true,event);if(typeof menuItemElement._actionId!=="undefined"){this._itemSelectedCallback(menuItemElement._actionId);delete menuItemElement._actionId;}
  7559. return;}
  7560. this._showSubMenu(menuItemElement);event.consume();},_showSubMenu:function(menuItemElement)
  7561. {if(menuItemElement._subMenuTimer){clearTimeout(menuItemElement._subMenuTimer);delete menuItemElement._subMenuTimer;}
  7562. if(this._subMenu)
  7563. return;this._subMenu=new WebInspector.SoftContextMenu(menuItemElement._subItems,this._itemSelectedCallback,this);this._subMenu.show(this._document,this._x+menuItemElement.offsetWidth-3,this._y+menuItemElement.offsetTop-1);},_hideSubMenu:function()
  7564. {if(!this._subMenu)
  7565. return;this._subMenu._discardSubMenus();this._focus();},_menuItemMouseOver:function(event)
  7566. {this._highlightMenuItem(event.target);},_menuItemMouseLeave:function(event)
  7567. {if(!this._subMenu||!event.relatedTarget){this._highlightMenuItem(null);return;}
  7568. var relatedTarget=event.relatedTarget;if(relatedTarget.classList.contains("soft-context-menu-glass-pane"))
  7569. this._highlightMenuItem(null);},_highlightMenuItem:function(menuItemElement)
  7570. {if(this._highlightedMenuItemElement===menuItemElement)
  7571. return;this._hideSubMenu();if(this._highlightedMenuItemElement){this._highlightedMenuItemElement.classList.remove("soft-context-menu-item-mouse-over");if(this._highlightedMenuItemElement._subItems&&this._highlightedMenuItemElement._subMenuTimer){clearTimeout(this._highlightedMenuItemElement._subMenuTimer);delete this._highlightedMenuItemElement._subMenuTimer;}}
  7572. this._highlightedMenuItemElement=menuItemElement;if(this._highlightedMenuItemElement){this._highlightedMenuItemElement.classList.add("soft-context-menu-item-mouse-over");this._contextMenuElement.focus();if(this._highlightedMenuItemElement._subItems&&!this._highlightedMenuItemElement._subMenuTimer)
  7573. this._highlightedMenuItemElement._subMenuTimer=setTimeout(this._showSubMenu.bind(this,this._highlightedMenuItemElement),150);}},_highlightPrevious:function()
  7574. {var menuItemElement=this._highlightedMenuItemElement?this._highlightedMenuItemElement.previousSibling:this._contextMenuElement.lastChild;while(menuItemElement&&menuItemElement._isSeparator)
  7575. menuItemElement=menuItemElement.previousSibling;if(menuItemElement)
  7576. this._highlightMenuItem(menuItemElement);},_highlightNext:function()
  7577. {var menuItemElement=this._highlightedMenuItemElement?this._highlightedMenuItemElement.nextSibling:this._contextMenuElement.firstChild;while(menuItemElement&&menuItemElement._isSeparator)
  7578. menuItemElement=menuItemElement.nextSibling;if(menuItemElement)
  7579. this._highlightMenuItem(menuItemElement);},_menuKeyDown:function(event)
  7580. {switch(event.keyIdentifier){case"Up":this._highlightPrevious();break;case"Down":this._highlightNext();break;case"Left":if(this._parentMenu){this._highlightMenuItem(null);this._parentMenu._focus();}
  7581. break;case"Right":if(!this._highlightedMenuItemElement)
  7582. break;if(this._highlightedMenuItemElement._subItems){this._showSubMenu(this._highlightedMenuItemElement);this._subMenu._focus();this._subMenu._highlightNext();}
  7583. break;case"U+001B":this._discardMenu(true,event);break;case"Enter":if(!isEnterKey(event))
  7584. break;case"U+0020":if(this._highlightedMenuItemElement)
  7585. this._triggerAction(this._highlightedMenuItemElement,event);break;}
  7586. event.consume(true);},_glassPaneMouseUp:function(event)
  7587. {if(event.x===this._x&&event.y===this._y&&new Date().getTime()-this._time<300)
  7588. return;this._discardMenu(true,event);event.consume();},_discardMenu:function(closeParentMenus,event)
  7589. {if(this._subMenu&&!closeParentMenus)
  7590. return;if(this._glassPaneElement){var glassPane=this._glassPaneElement;delete this._glassPaneElement;this._document.body.removeChild(glassPane);if(this._parentMenu){delete this._parentMenu._subMenu;if(closeParentMenus)
  7591. this._parentMenu._discardMenu(closeParentMenus,event);}
  7592. if(event)
  7593. event.consume(true);}else if(this._parentMenu&&this._contextMenuElement.parentElement){this._discardSubMenus();if(closeParentMenus)
  7594. this._parentMenu._discardMenu(closeParentMenus,event);if(event)
  7595. event.consume(true);}},_discardSubMenus:function()
  7596. {if(this._subMenu)
  7597. this._subMenu._discardSubMenus();this._contextMenuElement.remove();if(this._parentMenu)
  7598. delete this._parentMenu._subMenu;}};WebInspector.ViewportDataGrid=function(columnsArray,editCallback,deleteCallback,refreshCallback,contextMenuCallback)
  7599. {WebInspector.DataGrid.call(this,columnsArray,editCallback,deleteCallback,refreshCallback,contextMenuCallback);this._scrollContainer.addEventListener("scroll",this._onScroll.bind(this),true);this._scrollContainer.addEventListener("mousewheel",this._onWheel.bind(this),true);this._visibleNodes=[];this._updateScheduled=false;this._inline=false;this._wheelTarget=null;this._hiddenWheelTarget=null;this._stickToBottom=false;this._atBottom=true;this._lastScrollTop=0;this.setRootNode(new WebInspector.ViewportDataGridNode());}
  7600. WebInspector.ViewportDataGrid.prototype={onResize:function()
  7601. {if(this._stickToBottom&&this._atBottom)
  7602. this._scrollContainer.scrollTop=this._scrollContainer.scrollHeight-this._scrollContainer.clientHeight;this.scheduleUpdate();WebInspector.DataGrid.prototype.onResize.call(this);},setStickToBottom:function(stick)
  7603. {this._stickToBottom=stick;},_onWheel:function(event)
  7604. {this._wheelTarget=event.target?event.target.enclosingNodeOrSelfWithNodeName("tr"):null;},_onScroll:function(event)
  7605. {this._atBottom=this._scrollContainer.isScrolledToBottom();if(this._lastScrollTop!==this._scrollContainer.scrollTop)
  7606. this.scheduleUpdate();},scheduleUpdate:function()
  7607. {if(this._updateScheduled)
  7608. return;this._updateScheduled=true;this.element.window().requestAnimationFrame(this._update.bind(this));},renderInline:function()
  7609. {this._inline=true;WebInspector.DataGrid.prototype.renderInline.call(this);this._update();},_calculateVisibleNodes:function(clientHeight,scrollTop)
  7610. {var nodes=this._rootNode.children;if(this._inline)
  7611. return{topPadding:0,bottomPadding:0,visibleNodes:nodes,offset:0};var size=nodes.length;var i=0;var y=0;for(;i<size&&y+nodes[i].nodeSelfHeight()<scrollTop;++i)
  7612. y+=nodes[i].nodeSelfHeight();var start=i;var topPadding=y;for(;i<size&&y<scrollTop+clientHeight;++i)
  7613. y+=nodes[i].nodeSelfHeight();var end=i;var bottomPadding=0;for(;i<size;++i)
  7614. bottomPadding+=nodes[i].nodeSelfHeight();return{topPadding:topPadding,bottomPadding:bottomPadding,visibleNodes:nodes.slice(start,end),offset:start};},_contentHeight:function()
  7615. {var nodes=this._rootNode.children;var result=0;for(var i=0,size=nodes.length;i<size;++i)
  7616. result+=nodes[i].nodeSelfHeight();return result;},_update:function()
  7617. {this._updateScheduled=false;var clientHeight=this._scrollContainer.clientHeight;var scrollTop=this._scrollContainer.scrollTop;var currentScrollTop=scrollTop;var maxScrollTop=Math.max(0,this._contentHeight()-clientHeight);if(this._stickToBottom&&this._atBottom)
  7618. scrollTop=maxScrollTop;scrollTop=Math.min(maxScrollTop,scrollTop);this._atBottom=scrollTop===maxScrollTop;var viewportState=this._calculateVisibleNodes(clientHeight,scrollTop);var visibleNodes=viewportState.visibleNodes;var visibleNodesSet=Set.fromArray(visibleNodes);if(this._hiddenWheelTarget&&this._hiddenWheelTarget!==this._wheelTarget){this._hiddenWheelTarget.remove();this._hiddenWheelTarget=null;}
  7619. for(var i=0;i<this._visibleNodes.length;++i){var oldNode=this._visibleNodes[i];if(!visibleNodesSet.has(oldNode)){var element=oldNode.element();if(element===this._wheelTarget)
  7620. this._hiddenWheelTarget=oldNode.abandonElement();else
  7621. element.remove();oldNode.wasDetached();}}
  7622. var previousElement=this._topFillerRow;if(previousElement.nextSibling===this._hiddenWheelTarget)
  7623. previousElement=this._hiddenWheelTarget;var tBody=this.dataTableBody;var offset=viewportState.offset;for(var i=0;i<visibleNodes.length;++i){var node=visibleNodes[i];var element=node.element();node.willAttach();element.classList.toggle("odd",(offset+i)%2===0);tBody.insertBefore(element,previousElement.nextSibling);previousElement=element;}
  7624. this.setVerticalPadding(viewportState.topPadding,viewportState.bottomPadding);this._lastScrollTop=scrollTop;if(scrollTop!==currentScrollTop)
  7625. this._scrollContainer.scrollTop=scrollTop;this._visibleNodes=visibleNodes;},_revealViewportNode:function(node)
  7626. {var nodes=this._rootNode.children;var index=nodes.indexOf(node);if(index===-1)
  7627. return;var fromY=0;for(var i=0;i<index;++i)
  7628. fromY+=nodes[i].nodeSelfHeight();var toY=fromY+node.nodeSelfHeight();var scrollTop=this._scrollContainer.scrollTop;if(scrollTop>fromY){scrollTop=fromY;this._atBottom=false;}else if(scrollTop+this._scrollContainer.offsetHeight<toY){scrollTop=toY-this._scrollContainer.offsetHeight;}
  7629. this._scrollContainer.scrollTop=scrollTop;},__proto__:WebInspector.DataGrid.prototype}
  7630. WebInspector.ViewportDataGridNode=function(data)
  7631. {WebInspector.DataGridNode.call(this,data,false);this._stale=false;}
  7632. WebInspector.ViewportDataGridNode.prototype={element:function()
  7633. {if(!this._element){this.createElement();this.createCells();this._stale=false;}
  7634. if(this._stale){this.createCells();this._stale=false;}
  7635. return(this._element);},insertChild:function(child,index)
  7636. {child.parent=this;child.dataGrid=this.dataGrid;this.children.splice(index,0,child);child.recalculateSiblings(index);this.dataGrid.scheduleUpdate();},removeChild:function(child)
  7637. {child.deselect();this.children.remove(child,true);if(child.previousSibling)
  7638. child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
  7639. child.nextSibling.previousSibling=child.previousSibling;this.dataGrid.scheduleUpdate();},removeChildren:function()
  7640. {for(var i=0;i<this.children.length;++i)
  7641. this.children[i].deselect();this.children=[];this.dataGrid.scheduleUpdate();},expand:function()
  7642. {},willAttach:function(){},attached:function()
  7643. {return!!(this._element&&this._element.parentElement);},refresh:function()
  7644. {if(this.attached()){this._stale=true;this.dataGrid.scheduleUpdate();}else{this._element=null;}},abandonElement:function()
  7645. {var result=this._element;if(result)
  7646. result.style.display="none";this._element=null;return result;},reveal:function()
  7647. {this.dataGrid._revealViewportNode(this);},__proto__:WebInspector.DataGridNode.prototype};WebInspector.SortableDataGrid=function(columnsArray,editCallback,deleteCallback,refreshCallback,contextMenuCallback)
  7648. {WebInspector.ViewportDataGrid.call(this,columnsArray,editCallback,deleteCallback,refreshCallback,contextMenuCallback);this._sortingFunction=WebInspector.SortableDataGrid.TrivialComparator;this.setRootNode(new WebInspector.SortableDataGridNode());}
  7649. WebInspector.SortableDataGrid.NodeComparator;WebInspector.SortableDataGrid.TrivialComparator=function(a,b)
  7650. {return 0;}
  7651. WebInspector.SortableDataGrid.NumericComparator=function(columnIdentifier,a,b)
  7652. {var aValue=a.data[columnIdentifier];var bValue=b.data[columnIdentifier];var aNumber=Number(aValue instanceof Node?aValue.textContent:aValue);var bNumber=Number(bValue instanceof Node?bValue.textContent:bValue);return aNumber<bNumber?-1:(aNumber>bNumber?1:0);}
  7653. WebInspector.SortableDataGrid.StringComparator=function(columnIdentifier,a,b)
  7654. {var aValue=a.data[columnIdentifier];var bValue=b.data[columnIdentifier];var aString=aValue instanceof Node?aValue.textContent:String(aValue);var bString=bValue instanceof Node?bValue.textContent:String(bValue);return aString<bString?-1:(aString>bString?1:0);}
  7655. WebInspector.SortableDataGrid.Comparator=function(comparator,reverseMode,a,b)
  7656. {return reverseMode?comparator(b,a):comparator(a,b);}
  7657. WebInspector.SortableDataGrid.create=function(columnNames,values)
  7658. {var numColumns=columnNames.length;if(!numColumns)
  7659. return null;var columns=[];for(var i=0;i<columnNames.length;++i)
  7660. columns.push({title:columnNames[i],width:columnNames[i].length,sortable:true});var nodes=[];for(var i=0;i<values.length/numColumns;++i){var data={};for(var j=0;j<columnNames.length;++j)
  7661. data[j]=values[numColumns*i+j];var node=new WebInspector.SortableDataGridNode(data);node.selectable=false;nodes.push(node);}
  7662. var dataGrid=new WebInspector.SortableDataGrid(columns);var length=nodes.length;var rootNode=dataGrid.rootNode();for(var i=0;i<length;++i)
  7663. rootNode.appendChild(nodes[i]);dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,sortDataGrid);function sortDataGrid()
  7664. {var nodes=dataGrid.rootNode().children;var sortColumnIdentifier=dataGrid.sortColumnIdentifier();if(!sortColumnIdentifier)
  7665. return;var columnIsNumeric=true;for(var i=0;i<nodes.length;i++){var value=nodes[i].data[sortColumnIdentifier];if(isNaN(value instanceof Node?value.textContent:value)){columnIsNumeric=false;break;}}
  7666. var comparator=columnIsNumeric?WebInspector.SortableDataGrid.NumericComparator:WebInspector.SortableDataGrid.StringComparator;dataGrid.sortNodes(comparator.bind(null,sortColumnIdentifier),!dataGrid.isSortOrderAscending());}
  7667. return dataGrid;}
  7668. WebInspector.SortableDataGrid.prototype={insertChild:function(node)
  7669. {var parentNode=this.rootNode();parentNode.insertChild(node,parentNode.children.upperBound(node,this._sortingFunction));},sortNodes:function(comparator,reverseMode)
  7670. {this._sortingFunction=WebInspector.SortableDataGrid.Comparator.bind(null,comparator,reverseMode);var children=this._rootNode.children;children.sort(this._sortingFunction);for(var i=0;i<children.length;++i)
  7671. children[i].recalculateSiblings(i);this.scheduleUpdate();},__proto__:WebInspector.ViewportDataGrid.prototype}
  7672. WebInspector.SortableDataGridNode=function(data)
  7673. {WebInspector.ViewportDataGridNode.call(this,data);}
  7674. WebInspector.SortableDataGridNode.prototype={__proto__:WebInspector.ViewportDataGridNode.prototype};WebInspector.SplitView=function(isVertical,secondIsSidebar,settingName,defaultSidebarWidth,defaultSidebarHeight,constraintsInDip)
  7675. {WebInspector.View.call(this,true);this.element.classList.add("split-view");this.registerRequiredCSS("ui/splitView.css");this.contentElement.classList.add("shadow-split-view");this._mainElement=this.contentElement.createChild("div","shadow-split-view-contents shadow-split-view-main vbox");this._mainElement.createChild("content").select=".insertion-point-main";this._sidebarElement=this.contentElement.createChild("div","shadow-split-view-contents shadow-split-view-sidebar vbox");this._sidebarElement.createChild("content").select=".insertion-point-sidebar";this._resizerElement=this.contentElement.createChild("div","shadow-split-view-resizer");this._resizerWidget=new WebInspector.ResizerWidget();this._resizerWidget.setEnabled(true);this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.ResizeStart,this._onResizeStart,this);this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.ResizeUpdate,this._onResizeUpdate,this);this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.ResizeEnd,this._onResizeEnd,this);this._defaultSidebarWidth=defaultSidebarWidth||200;this._defaultSidebarHeight=defaultSidebarHeight||this._defaultSidebarWidth;this._constraintsInDip=!!constraintsInDip;this._settingName=settingName;this.setSecondIsSidebar(secondIsSidebar);this._innerSetVertical(isVertical);this._showMode=WebInspector.SplitView.ShowMode.Both;this.installResizer(this._resizerElement);}
  7676. WebInspector.SplitView.SettingForOrientation;WebInspector.SplitView.ShowMode={Both:"Both",OnlyMain:"OnlyMain",OnlySidebar:"OnlySidebar"}
  7677. WebInspector.SplitView.Events={SidebarSizeChanged:"SidebarSizeChanged",ShowModeChanged:"ShowModeChanged"}
  7678. WebInspector.SplitView.MinPadding=20;WebInspector.SplitView.prototype={isVertical:function()
  7679. {return this._isVertical;},setVertical:function(isVertical)
  7680. {if(this._isVertical===isVertical)
  7681. return;this._innerSetVertical(isVertical);if(this.isShowing())
  7682. this._updateLayout();},_innerSetVertical:function(isVertical)
  7683. {this.contentElement.classList.toggle("vbox",!isVertical);this.contentElement.classList.toggle("hbox",isVertical);this._isVertical=isVertical;delete this._resizerElementSize;this._sidebarSizeDIP=-1;this._restoreSidebarSizeFromSettings();if(this._shouldSaveShowMode)
  7684. this._restoreAndApplyShowModeFromSettings();this._updateShowHideSidebarButton();this._resizerWidget.setVertical(!isVertical);this.invalidateConstraints();},_updateLayout:function(animate)
  7685. {delete this._totalSizeCSS;delete this._totalSizeOtherDimensionCSS;this._mainElement.style.removeProperty("width");this._mainElement.style.removeProperty("height");this._sidebarElement.style.removeProperty("width");this._sidebarElement.style.removeProperty("height");this._innerSetSidebarSizeDIP(this._preferredSidebarSizeDIP(),!!animate);},setMainView:function(view)
  7686. {if(this._mainView)
  7687. this._mainView.detach();this._mainView=view;if(view){view.element.classList.add("insertion-point-main");view.element.classList.remove("insertion-point-sidebar");if(this._showMode===WebInspector.SplitView.ShowMode.OnlyMain||this._showMode===WebInspector.SplitView.ShowMode.Both)
  7688. view.show(this.element);}},setSidebarView:function(view)
  7689. {if(this._sidebarView)
  7690. this._sidebarView.detach();this._sidebarView=view;if(view){view.element.classList.add("insertion-point-sidebar");view.element.classList.remove("insertion-point-main");if(this._showMode===WebInspector.SplitView.ShowMode.OnlySidebar||this._showMode===WebInspector.SplitView.ShowMode.Both)
  7691. view.show(this.element);}},mainView:function()
  7692. {return this._mainView;},sidebarView:function()
  7693. {return this._sidebarView;},childWasDetached:function(view)
  7694. {if(this._detaching)
  7695. return;if(this._mainView===view)
  7696. delete this._mainView;if(this._sidebarView===view)
  7697. delete this._sidebarView;},isSidebarSecond:function()
  7698. {return this._secondIsSidebar;},enableShowModeSaving:function()
  7699. {this._shouldSaveShowMode=true;this._restoreAndApplyShowModeFromSettings();},showMode:function()
  7700. {return this._showMode;},setSecondIsSidebar:function(secondIsSidebar)
  7701. {this.contentElement.classList.toggle("shadow-split-view-first-is-sidebar",!secondIsSidebar);this._secondIsSidebar=secondIsSidebar;},sidebarSide:function()
  7702. {if(this._showMode!==WebInspector.SplitView.ShowMode.Both)
  7703. return null;return this._isVertical?(this._secondIsSidebar?"right":"left"):(this._secondIsSidebar?"bottom":"top");},preferredSidebarSize:function()
  7704. {return this._preferredSidebarSizeDIP();},resizerElement:function()
  7705. {return this._resizerElement;},hideMain:function(animate)
  7706. {this._showOnly(this._sidebarView,this._mainView,this._sidebarElement,this._mainElement,animate);this._updateShowMode(WebInspector.SplitView.ShowMode.OnlySidebar);},hideSidebar:function(animate)
  7707. {this._showOnly(this._mainView,this._sidebarView,this._mainElement,this._sidebarElement,animate);this._updateShowMode(WebInspector.SplitView.ShowMode.OnlyMain);},_showOnly:function(sideToShow,sideToHide,shadowToShow,shadowToHide,animate)
  7708. {this._cancelAnimation();function callback()
  7709. {if(sideToShow){if(sideToShow===this._mainView)
  7710. this._mainView.show(this.element,this._sidebarView?this._sidebarView.element:null);else
  7711. this._sidebarView.show(this.element);}
  7712. if(sideToHide){this._detaching=true;sideToHide.detach();delete this._detaching;}
  7713. this._resizerElement.classList.add("hidden");shadowToShow.classList.remove("hidden");shadowToShow.classList.add("maximized");shadowToHide.classList.add("hidden");shadowToHide.classList.remove("maximized");this._removeAllLayoutProperties();}
  7714. if(animate){this._animate(true,callback.bind(this));}else{callback.call(this);this.doResize();}
  7715. this._sidebarSizeDIP=-1;this.setResizable(false);},_removeAllLayoutProperties:function()
  7716. {this._sidebarElement.style.removeProperty("flexBasis");this._mainElement.style.removeProperty("width");this._mainElement.style.removeProperty("height");this._sidebarElement.style.removeProperty("width");this._sidebarElement.style.removeProperty("height");this._resizerElement.style.removeProperty("left");this._resizerElement.style.removeProperty("right");this._resizerElement.style.removeProperty("top");this._resizerElement.style.removeProperty("bottom");this._resizerElement.style.removeProperty("margin-left");this._resizerElement.style.removeProperty("margin-right");this._resizerElement.style.removeProperty("margin-top");this._resizerElement.style.removeProperty("margin-bottom");},showBoth:function(animate)
  7717. {if(this._showMode===WebInspector.SplitView.ShowMode.Both)
  7718. animate=false;this._cancelAnimation();this._mainElement.classList.remove("maximized","hidden");this._sidebarElement.classList.remove("maximized","hidden");this._resizerElement.classList.remove("hidden");if(this._sidebarView)
  7719. this._sidebarView.show(this.element);if(this._mainView)
  7720. this._mainView.show(this.element,this._sidebarView?this._sidebarView.element:null);this.setSecondIsSidebar(this._secondIsSidebar);this._sidebarSizeDIP=-1;this.setResizable(true);this._updateShowMode(WebInspector.SplitView.ShowMode.Both);this._updateLayout(animate);},setResizable:function(resizable)
  7721. {this._resizerWidget.setEnabled(resizable);},isResizable:function()
  7722. {return this._resizerWidget.isEnabled();},setSidebarSize:function(size)
  7723. {var sizeDIP=WebInspector.zoomManager.cssToDIP(size);this._savedSidebarSizeDIP=sizeDIP;this._saveSetting();this._innerSetSidebarSizeDIP(sizeDIP,false,true);},sidebarSize:function()
  7724. {var sizeDIP=Math.max(0,this._sidebarSizeDIP);return WebInspector.zoomManager.dipToCSS(sizeDIP);},_totalSizeDIP:function()
  7725. {if(!this._totalSizeCSS){this._totalSizeCSS=this._isVertical?this.contentElement.offsetWidth:this.contentElement.offsetHeight;this._totalSizeOtherDimensionCSS=this._isVertical?this.contentElement.offsetHeight:this.contentElement.offsetWidth;}
  7726. return WebInspector.zoomManager.cssToDIP(this._totalSizeCSS);},_updateShowMode:function(showMode)
  7727. {this._showMode=showMode;this._saveShowModeToSettings();this._updateShowHideSidebarButton();this.dispatchEventToListeners(WebInspector.SplitView.Events.ShowModeChanged,showMode);this.invalidateConstraints();},_innerSetSidebarSizeDIP:function(sizeDIP,animate,userAction)
  7728. {if(this._showMode!==WebInspector.SplitView.ShowMode.Both||!this.isShowing())
  7729. return;sizeDIP=this._applyConstraints(sizeDIP,userAction);if(this._sidebarSizeDIP===sizeDIP)
  7730. return;if(!this._resizerElementSize)
  7731. this._resizerElementSize=this._isVertical?this._resizerElement.offsetWidth:this._resizerElement.offsetHeight;this._removeAllLayoutProperties();var sidebarSizeValue=WebInspector.zoomManager.dipToCSS(sizeDIP)+"px";var mainSizeValue=(this._totalSizeCSS-WebInspector.zoomManager.dipToCSS(sizeDIP))+"px";this._sidebarElement.style.flexBasis=sidebarSizeValue;if(this._isVertical){this._sidebarElement.style.width=sidebarSizeValue;this._mainElement.style.width=mainSizeValue;this._sidebarElement.style.height=this._totalSizeOtherDimensionCSS+"px";this._mainElement.style.height=this._totalSizeOtherDimensionCSS+"px";}else{this._sidebarElement.style.height=sidebarSizeValue;this._mainElement.style.height=mainSizeValue;this._sidebarElement.style.width=this._totalSizeOtherDimensionCSS+"px";this._mainElement.style.width=this._totalSizeOtherDimensionCSS+"px";}
  7732. if(this._isVertical){if(this._secondIsSidebar){this._resizerElement.style.right=sidebarSizeValue;this._resizerElement.style.marginRight=-this._resizerElementSize/2+"px";}else{this._resizerElement.style.left=sidebarSizeValue;this._resizerElement.style.marginLeft=-this._resizerElementSize/2+"px";}}else{if(this._secondIsSidebar){this._resizerElement.style.bottom=sidebarSizeValue;this._resizerElement.style.marginBottom=-this._resizerElementSize/2+"px";}else{this._resizerElement.style.top=sidebarSizeValue;this._resizerElement.style.marginTop=-this._resizerElementSize/2+"px";}}
  7733. this._sidebarSizeDIP=sizeDIP;if(animate){this._animate(false);}else{this.doResize();this.dispatchEventToListeners(WebInspector.SplitView.Events.SidebarSizeChanged,this.sidebarSize());}},_animate:function(reverse,callback)
  7734. {var animationTime=50;this._animationCallback=callback;var animatedMarginPropertyName;if(this._isVertical)
  7735. animatedMarginPropertyName=this._secondIsSidebar?"margin-right":"margin-left";else
  7736. animatedMarginPropertyName=this._secondIsSidebar?"margin-bottom":"margin-top";var marginFrom=reverse?"0":"-"+WebInspector.zoomManager.dipToCSS(this._sidebarSizeDIP)+"px";var marginTo=reverse?"-"+WebInspector.zoomManager.dipToCSS(this._sidebarSizeDIP)+"px":"0";this.contentElement.style.setProperty(animatedMarginPropertyName,marginFrom);if(!reverse){suppressUnused(this._mainElement.offsetWidth);suppressUnused(this._sidebarElement.offsetWidth);}
  7737. if(!reverse)
  7738. this._sidebarView.doResize();this.contentElement.style.setProperty("transition",animatedMarginPropertyName+" "+animationTime+"ms linear");var boundAnimationFrame;var startTime;function animationFrame()
  7739. {delete this._animationFrameHandle;if(!startTime){this.contentElement.style.setProperty(animatedMarginPropertyName,marginTo);startTime=window.performance.now();}else if(window.performance.now()<startTime+animationTime){if(this._mainView)
  7740. this._mainView.doResize();}else{this._cancelAnimation();if(this._mainView)
  7741. this._mainView.doResize();this.dispatchEventToListeners(WebInspector.SplitView.Events.SidebarSizeChanged,this.sidebarSize());return;}
  7742. this._animationFrameHandle=this.contentElement.window().requestAnimationFrame(boundAnimationFrame);}
  7743. boundAnimationFrame=animationFrame.bind(this);this._animationFrameHandle=this.contentElement.window().requestAnimationFrame(boundAnimationFrame);},_cancelAnimation:function()
  7744. {this.contentElement.style.removeProperty("margin-top");this.contentElement.style.removeProperty("margin-right");this.contentElement.style.removeProperty("margin-bottom");this.contentElement.style.removeProperty("margin-left");this.contentElement.style.removeProperty("transition");if(this._animationFrameHandle){this.contentElement.window().cancelAnimationFrame(this._animationFrameHandle);delete this._animationFrameHandle;}
  7745. if(this._animationCallback){this._animationCallback();delete this._animationCallback;}},_applyConstraints:function(sidebarSize,userAction)
  7746. {var totalSize=this._totalSizeDIP();var zoomFactor=this._constraintsInDip?1:WebInspector.zoomManager.zoomFactor();var constraints=this._sidebarView?this._sidebarView.constraints():new Constraints();var minSidebarSize=this.isVertical()?constraints.minimum.width:constraints.minimum.height;if(!minSidebarSize)
  7747. minSidebarSize=WebInspector.SplitView.MinPadding;minSidebarSize*=zoomFactor;var preferredSidebarSize=this.isVertical()?constraints.preferred.width:constraints.preferred.height;if(!preferredSidebarSize)
  7748. preferredSidebarSize=WebInspector.SplitView.MinPadding;preferredSidebarSize*=zoomFactor;if(sidebarSize<preferredSidebarSize)
  7749. preferredSidebarSize=Math.max(sidebarSize,minSidebarSize);preferredSidebarSize+=zoomFactor;constraints=this._mainView?this._mainView.constraints():new Constraints();var minMainSize=this.isVertical()?constraints.minimum.width:constraints.minimum.height;if(!minMainSize)
  7750. minMainSize=WebInspector.SplitView.MinPadding;minMainSize*=zoomFactor;var preferredMainSize=this.isVertical()?constraints.preferred.width:constraints.preferred.height;if(!preferredMainSize)
  7751. preferredMainSize=WebInspector.SplitView.MinPadding;preferredMainSize*=zoomFactor;var savedMainSize=this.isVertical()?this._savedVerticalMainSize:this._savedHorizontalMainSize;if(typeof savedMainSize!=="undefined")
  7752. preferredMainSize=Math.min(preferredMainSize,savedMainSize*zoomFactor);if(userAction)
  7753. preferredMainSize=minMainSize;var totalPreferred=preferredMainSize+preferredSidebarSize;if(totalPreferred<=totalSize)
  7754. return Number.constrain(sidebarSize,preferredSidebarSize,totalSize-preferredMainSize);if(minMainSize+minSidebarSize<=totalSize){var delta=totalPreferred-totalSize;var sidebarDelta=delta*preferredSidebarSize/totalPreferred;sidebarSize=preferredSidebarSize-sidebarDelta;return Number.constrain(sidebarSize,minSidebarSize,totalSize-minMainSize);}
  7755. return Math.max(0,totalSize-minMainSize);},wasShown:function()
  7756. {this._forceUpdateLayout();WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged,this._onZoomChanged,this);},willHide:function()
  7757. {WebInspector.zoomManager.removeEventListener(WebInspector.ZoomManager.Events.ZoomChanged,this._onZoomChanged,this);},onResize:function()
  7758. {this._updateLayout();},onLayout:function()
  7759. {this._updateLayout();},calculateConstraints:function()
  7760. {if(this._showMode===WebInspector.SplitView.ShowMode.OnlyMain)
  7761. return this._mainView?this._mainView.constraints():new Constraints();if(this._showMode===WebInspector.SplitView.ShowMode.OnlySidebar)
  7762. return this._sidebarView?this._sidebarView.constraints():new Constraints();var mainConstraints=this._mainView?this._mainView.constraints():new Constraints();var sidebarConstraints=this._sidebarView?this._sidebarView.constraints():new Constraints();var min=WebInspector.SplitView.MinPadding;if(this._isVertical){mainConstraints=mainConstraints.widthToMax(min).addWidth(1);sidebarConstraints=sidebarConstraints.widthToMax(min);return mainConstraints.addWidth(sidebarConstraints).heightToMax(sidebarConstraints);}else{mainConstraints=mainConstraints.heightToMax(min).addHeight(1);sidebarConstraints=sidebarConstraints.heightToMax(min);return mainConstraints.widthToMax(sidebarConstraints).addHeight(sidebarConstraints);}},_onResizeStart:function(event)
  7763. {this._resizeStartSizeDIP=this._sidebarSizeDIP;},_onResizeUpdate:function(event)
  7764. {var offset=event.data.currentPosition-event.data.startPosition;var offsetDIP=WebInspector.zoomManager.cssToDIP(offset);var newSizeDIP=this._secondIsSidebar?this._resizeStartSizeDIP-offsetDIP:this._resizeStartSizeDIP+offsetDIP;var constrainedSizeDIP=this._applyConstraints(newSizeDIP,true);this._savedSidebarSizeDIP=constrainedSizeDIP;this._saveSetting();this._innerSetSidebarSizeDIP(constrainedSizeDIP,false,true);if(this.isVertical())
  7765. this._savedVerticalMainSize=this._totalSizeDIP()-this._sidebarSizeDIP;else
  7766. this._savedHorizontalMainSize=this._totalSizeDIP()-this._sidebarSizeDIP;},_onResizeEnd:function(event)
  7767. {delete this._resizeStartSizeDIP;},hideDefaultResizer:function()
  7768. {this.uninstallResizer(this._resizerElement);},installResizer:function(resizerElement)
  7769. {this._resizerWidget.addElement(resizerElement);},uninstallResizer:function(resizerElement)
  7770. {this._resizerWidget.removeElement(resizerElement);},hasCustomResizer:function()
  7771. {var elements=this._resizerWidget.elements();return elements.length>1||(elements.length==1&&elements[0]!==this._resizerElement);},toggleResizer:function(resizer,on)
  7772. {if(on)
  7773. this.installResizer(resizer);else
  7774. this.uninstallResizer(resizer);},_setting:function()
  7775. {if(!this._settingName)
  7776. return null;if(!WebInspector.settings[this._settingName])
  7777. WebInspector.settings[this._settingName]=WebInspector.settings.createSetting(this._settingName,{});return WebInspector.settings[this._settingName];},_settingForOrientation:function()
  7778. {var state=this._setting()?this._setting().get():{};return this._isVertical?state.vertical:state.horizontal;},_preferredSidebarSizeDIP:function()
  7779. {var size=this._savedSidebarSizeDIP;if(!size){size=this._isVertical?this._defaultSidebarWidth:this._defaultSidebarHeight;if(0<size&&size<1)
  7780. size*=this._totalSizeDIP();}
  7781. return size;},_restoreSidebarSizeFromSettings:function()
  7782. {var settingForOrientation=this._settingForOrientation();this._savedSidebarSizeDIP=settingForOrientation?settingForOrientation.size:0;},_restoreAndApplyShowModeFromSettings:function()
  7783. {var orientationState=this._settingForOrientation();this._savedShowMode=orientationState?orientationState.showMode:WebInspector.SplitView.ShowMode.Both;this._showMode=this._savedShowMode;switch(this._savedShowMode){case WebInspector.SplitView.ShowMode.Both:this.showBoth();break;case WebInspector.SplitView.ShowMode.OnlyMain:this.hideSidebar();break;case WebInspector.SplitView.ShowMode.OnlySidebar:this.hideMain();break;}},_saveShowModeToSettings:function()
  7784. {this._savedShowMode=this._showMode;this._saveSetting();},_saveSetting:function()
  7785. {var setting=this._setting();if(!setting)
  7786. return;var state=setting.get();var orientationState=(this._isVertical?state.vertical:state.horizontal)||{};orientationState.size=this._savedSidebarSizeDIP;if(this._shouldSaveShowMode)
  7787. orientationState.showMode=this._savedShowMode;if(this._isVertical)
  7788. state.vertical=orientationState;else
  7789. state.horizontal=orientationState;setting.set(state);},_forceUpdateLayout:function()
  7790. {this._sidebarSizeDIP=-1;this._updateLayout();},_onZoomChanged:function(event)
  7791. {this._forceUpdateLayout();},displayShowHideSidebarButton:function(title,className)
  7792. {console.assert(this.isVertical(),"Buttons for split view with horizontal split are not supported yet.");this._showHideSidebarButtonTitle=WebInspector.UIString(title);this._showHideSidebarButton=this._mainElement.createChild("button","sidebar-show-hide-button "+(className||""));this._showHideSidebarButton.addEventListener("click",buttonClicked.bind(this),false);this._updateShowHideSidebarButton();function buttonClicked(event)
  7793. {if(this._showMode!==WebInspector.SplitView.ShowMode.Both)
  7794. this.showBoth(true);else
  7795. this.hideSidebar(true);}
  7796. return this._showHideSidebarButton;},_updateShowHideSidebarButton:function()
  7797. {if(!this._showHideSidebarButton)
  7798. return;var sidebarHidden=this._showMode===WebInspector.SplitView.ShowMode.OnlyMain;this._showHideSidebarButton.classList.toggle("toggled-show",sidebarHidden);this._showHideSidebarButton.classList.toggle("toggled-hide",!sidebarHidden);this._showHideSidebarButton.classList.toggle("top-sidebar-show-hide-button",!this.isVertical()&&!this.isSidebarSecond());this._showHideSidebarButton.classList.toggle("right-sidebar-show-hide-button",this.isVertical()&&this.isSidebarSecond());this._showHideSidebarButton.classList.toggle("bottom-sidebar-show-hide-button",!this.isVertical()&&this.isSidebarSecond());this._showHideSidebarButton.classList.toggle("left-sidebar-show-hide-button",this.isVertical()&&!this.isSidebarSecond());this._showHideSidebarButton.title=sidebarHidden?WebInspector.UIString("Show %s",this._showHideSidebarButtonTitle):WebInspector.UIString("Hide %s",this._showHideSidebarButtonTitle);},__proto__:WebInspector.View.prototype};WebInspector.StackView=function(isVertical)
  7799. {WebInspector.VBox.call(this);this._isVertical=isVertical;this._currentSplitView=null;}
  7800. WebInspector.StackView.prototype={appendView:function(view,sidebarSizeSettingName,defaultSidebarWidth,defaultSidebarHeight)
  7801. {var splitView=new WebInspector.SplitView(this._isVertical,true,sidebarSizeSettingName,defaultSidebarWidth,defaultSidebarHeight);splitView.setMainView(view);splitView.hideSidebar();if(!this._currentSplitView){splitView.show(this.element);}else{this._currentSplitView.setSidebarView(splitView);this._currentSplitView.showBoth();}
  7802. this._currentSplitView=splitView;return splitView;},detachChildViews:function()
  7803. {WebInspector.View.prototype.detachChildViews.call(this);this._currentSplitView=null;},__proto__:WebInspector.VBox.prototype};WebInspector.StatusBar=function(parentElement)
  7804. {this._items=[];this.element=parentElement?parentElement.createChild("div","status-bar"):createElementWithClass("div","status-bar");this._shadowRoot=this.element.createShadowRoot();this._shadowRoot.appendChild(WebInspector.View.createStyleElement("ui/statusBar.css"));this._contentElement=this._shadowRoot.createChild("div","status-bar-shadow");this._contentElement.createChild("content");WebInspector.installComponentRootStyles(this._contentElement);}
  7805. WebInspector.StatusBar.prototype={makeNarrow:function()
  7806. {this._contentElement.classList.add("narrow");},makeVertical:function()
  7807. {this._contentElement.classList.add("vertical");},setEnabled:function(enabled)
  7808. {for(var item of this._items)
  7809. item.setEnabled(enabled);},appendStatusBarItem:function(item)
  7810. {this._items.push(item);if(item._isLightDOM)
  7811. this.element.appendChild(item.element);else
  7812. this._contentElement.insertBefore(item.element,this._contentElement.lastChild);},removeStatusBarItems:function()
  7813. {this._items=[];this._contentElement.removeChildren();this._contentElement.createChild("content");},setColor:function(color)
  7814. {var style=createElement("style");style.textContent="button.status-bar-item .glyph { background-color: "+color+" !important }";this._shadowRoot.appendChild(style);},setToggledColor:function(color)
  7815. {var style=createElement("style");style.textContent="button.status-bar-item.toggled-on .glyph { background-color: "+color+" !important }";this._shadowRoot.appendChild(style);}}
  7816. WebInspector.StatusBarItem=function(element,isLightDOM)
  7817. {this.element=element;this.element.classList.add("status-bar-item");this._enabled=true;this._visible=true;this._isLightDOM=isLightDOM;}
  7818. WebInspector.StatusBarItem.prototype={setEnabled:function(value)
  7819. {if(this._enabled===value)
  7820. return;this._enabled=value;this._applyEnabledState();},_applyEnabledState:function()
  7821. {this.element.disabled=!this._enabled;},visible:function()
  7822. {return this._visible;},setVisible:function(x)
  7823. {if(this._visible===x)
  7824. return;this.element.classList.toggle("hidden",!x);this._visible=x;},__proto__:WebInspector.Object.prototype}
  7825. WebInspector.StatusBarCounter=function(counters,className)
  7826. {WebInspector.StatusBarItem.call(this,createElementWithClass("div","status-bar-counter hidden"));if(className)
  7827. this.element.classList.add(className);this.element.addEventListener("click",this._clicked.bind(this),false);this._counters=[];for(var i=0;i<counters.length;++i){var element=this.element.createChild("span","status-bar-counter-item");element.createChild("div",counters[i]);element.createChild("span");this._counters.push({counter:counters[i],element:element,value:0,title:""});}
  7828. this._update();}
  7829. WebInspector.StatusBarCounter.prototype={setCounter:function(counter,value,title)
  7830. {for(var i=0;i<this._counters.length;++i){if(this._counters[i].counter===counter){this._counters[i].value=value;this._counters[i].title=title;this._update();return;}}},_update:function()
  7831. {var total=0;var title="";for(var i=0;i<this._counters.length;++i){var counter=this._counters[i];var value=counter.value;if(!counter.value){counter.element.classList.add("hidden");continue;}
  7832. counter.element.classList.remove("hidden");counter.element.classList.toggle("status-bar-counter-item-first",!total);counter.element.querySelector("span").textContent=value;total+=value;if(counter.title){if(title)
  7833. title+=", ";title+=counter.title;}}
  7834. this.element.classList.toggle("hidden",!total);this.element.title=title;},_clicked:function(event)
  7835. {this.dispatchEventToListeners("click");},__proto__:WebInspector.StatusBarItem.prototype}
  7836. WebInspector.StatusBarText=function(text,className)
  7837. {WebInspector.StatusBarItem.call(this,createElementWithClass("span","status-bar-text"));if(className)
  7838. this.element.classList.add(className);this.element.textContent=text;}
  7839. WebInspector.StatusBarText.prototype={setText:function(text)
  7840. {this.element.textContent=text;},__proto__:WebInspector.StatusBarItem.prototype}
  7841. WebInspector.StatusBarInput=function(placeholder,growFactor)
  7842. {WebInspector.StatusBarItem.call(this,createElementWithClass("input","status-bar-item"));this.element.addEventListener("input",this._onChangeCallback.bind(this),false);if(growFactor)
  7843. this.element.style.flexGrow=growFactor;if(placeholder)
  7844. this.element.setAttribute("placeholder",placeholder);this._value="";}
  7845. WebInspector.StatusBarInput.Event={TextChanged:"TextChanged"};WebInspector.StatusBarInput.prototype={setValue:function(value)
  7846. {this._value=value;this.element.value=value;},value:function()
  7847. {return this.element.value;},_onChangeCallback:function()
  7848. {this.dispatchEventToListeners(WebInspector.StatusBarInput.Event.TextChanged,this.element.value);},__proto__:WebInspector.StatusBarItem.prototype}
  7849. WebInspector.StatusBarButtonBase=function(title,className,states)
  7850. {WebInspector.StatusBarItem.call(this,createElementWithClass("button",className+" status-bar-item"));this.element.addEventListener("click",this._clicked.bind(this),false);this._longClickController=new WebInspector.LongClickController(this.element);this._longClickController.addEventListener(WebInspector.LongClickController.Events.LongClick,this._onLongClick.bind(this));this._longClickController.addEventListener(WebInspector.LongClickController.Events.LongPress,this._onLongPress.bind(this));this._states=states;if(!states)
  7851. this._states=2;if(states==2)
  7852. this._state="off";else
  7853. this._state="0";this.setTitle(title);this.className=className;}
  7854. WebInspector.StatusBarButtonBase.prototype={_onLongClick:function(event)
  7855. {this.dispatchEventToListeners("longClickDown");},_onLongPress:function(event)
  7856. {this.dispatchEventToListeners("longPressDown");},_clicked:function()
  7857. {this.dispatchEventToListeners("click");this._longClickController.reset();},_applyEnabledState:function()
  7858. {this.element.disabled=!this._enabled;this._longClickController.reset();},enabled:function()
  7859. {return this._enabled;},title:function()
  7860. {return this._title;},setTitle:function(x)
  7861. {if(this._title===x)
  7862. return;this._title=x;this.element.title=x;},state:function()
  7863. {return this._state;},setState:function(x)
  7864. {if(this._state===x)
  7865. return;this.element.classList.remove("toggled-"+this._state);this.element.classList.add("toggled-"+x);this._state=x;},toggled:function()
  7866. {if(this._states!==2)
  7867. throw("Only used toggled when there are 2 states, otherwise, use state");return this.state()==="on";},setToggled:function(x)
  7868. {if(this._states!==2)
  7869. throw("Only used toggled when there are 2 states, otherwise, use state");this.setState(x?"on":"off");},makeLongClickEnabled:function()
  7870. {this._longClickController.enable();},unmakeLongClickEnabled:function()
  7871. {this._longClickController.disable();},setLongClickOptionsEnabled:function(buttonsProvider)
  7872. {if(buttonsProvider){if(!this._longClickOptionsData){this.makeLongClickEnabled();this.longClickGlyph=this.element.createChild("div","fill long-click-glyph status-bar-button-theme");var longClickDownListener=this._showOptions.bind(this);this.addEventListener("longClickDown",longClickDownListener,this);this._longClickOptionsData={glyphElement:this.longClickGlyph,longClickDownListener:longClickDownListener};}
  7873. this._longClickOptionsData.buttonsProvider=buttonsProvider;}else{if(!this._longClickOptionsData)
  7874. return;this.element.removeChild(this._longClickOptionsData.glyphElement);this.removeEventListener("longClickDown",this._longClickOptionsData.longClickDownListener,this);delete this._longClickOptionsData;this.unmakeLongClickEnabled();}},_showOptions:function()
  7875. {var buttons=this._longClickOptionsData.buttonsProvider();var mainButtonClone=new WebInspector.StatusBarButton(this.title(),this.className,this._states);mainButtonClone.addEventListener("click",this._clicked,this);mainButtonClone.setState(this.state());buttons.push(mainButtonClone);var document=this.element.ownerDocument;document.documentElement.addEventListener("mouseup",mouseUp,false);var optionsGlassPane=new WebInspector.GlassPane(document);var optionsBar=new WebInspector.StatusBar(optionsGlassPane.element);optionsBar.element.classList.add("fill");optionsBar._contentElement.classList.add("floating");const buttonHeight=23;var hostButtonPosition=this.element.totalOffset();var topNotBottom=hostButtonPosition.top+buttonHeight*buttons.length<document.documentElement.offsetHeight;if(topNotBottom)
  7876. buttons=buttons.reverse();optionsBar.element.style.height=(buttonHeight*buttons.length)+"px";if(topNotBottom)
  7877. optionsBar.element.style.top=(hostButtonPosition.top+1)+"px";else
  7878. optionsBar.element.style.top=(hostButtonPosition.top-(buttonHeight*(buttons.length-1)))+"px";optionsBar.element.style.left=(hostButtonPosition.left+1)+"px";for(var i=0;i<buttons.length;++i){buttons[i].element.addEventListener("mousemove",mouseOver,false);buttons[i].element.addEventListener("mouseout",mouseOut,false);optionsBar.appendStatusBarItem(buttons[i]);}
  7879. var hostButtonIndex=topNotBottom?0:buttons.length-1;buttons[hostButtonIndex].element.classList.add("emulate-active");function mouseOver(e)
  7880. {if(e.which!==1)
  7881. return;var buttonElement=e.target.enclosingNodeOrSelfWithClass("status-bar-item");buttonElement.classList.add("emulate-active");}
  7882. function mouseOut(e)
  7883. {if(e.which!==1)
  7884. return;var buttonElement=e.target.enclosingNodeOrSelfWithClass("status-bar-item");buttonElement.classList.remove("emulate-active");}
  7885. function mouseUp(e)
  7886. {if(e.which!==1)
  7887. return;optionsGlassPane.dispose();document.documentElement.removeEventListener("mouseup",mouseUp,false);for(var i=0;i<buttons.length;++i){if(buttons[i].element.classList.contains("emulate-active")){buttons[i].element.classList.remove("emulate-active");buttons[i]._clicked();break;}}}},__proto__:WebInspector.StatusBarItem.prototype}
  7888. WebInspector.StatusBarButton=function(title,className,states)
  7889. {WebInspector.StatusBarButtonBase.call(this,title,className,states);this._glyphElement=this.element.createChild("div","glyph status-bar-button-theme");}
  7890. WebInspector.StatusBarButton.prototype={setBackgroundImage:function(iconURL)
  7891. {this.element.style.backgroundImage="url("+iconURL+")";this._glyphElement.classList.add("hidden");},__proto__:WebInspector.StatusBarButtonBase.prototype}
  7892. WebInspector.StatusBarSeparator=function()
  7893. {WebInspector.StatusBarItem.call(this,createElementWithClass("div","status-bar-divider"));}
  7894. WebInspector.StatusBarSeparator.prototype={__proto__:WebInspector.StatusBarItem.prototype}
  7895. WebInspector.StatusBarTextButton=function(title,className,text,states)
  7896. {WebInspector.StatusBarButtonBase.call(this,title,className,states);this._textElement=this.element.createChild("div","status-bar-button-text");this._textElement.textContent=text;}
  7897. WebInspector.StatusBarTextButton.prototype={__proto__:WebInspector.StatusBarButtonBase.prototype}
  7898. WebInspector.StatusBarItem.Provider=function()
  7899. {}
  7900. WebInspector.StatusBarItem.Provider.prototype={item:function(){}}
  7901. WebInspector.StatusBarComboBox=function(changeHandler,className)
  7902. {WebInspector.StatusBarItem.call(this,createElementWithClass("span","status-bar-select-container"));this._selectElement=this.element.createChild("select","status-bar-item");this.element.createChild("div","status-bar-select-arrow");if(changeHandler)
  7903. this._selectElement.addEventListener("change",changeHandler,false);if(className)
  7904. this._selectElement.classList.add(className);}
  7905. WebInspector.StatusBarComboBox.prototype={selectElement:function()
  7906. {return this._selectElement;},size:function()
  7907. {return this._selectElement.childElementCount;},addOption:function(option)
  7908. {this._selectElement.appendChild(option);},createOption:function(label,title,value)
  7909. {var option=this._selectElement.createChild("option");option.text=label;if(title)
  7910. option.title=title;if(typeof value!=="undefined")
  7911. option.value=value;return option;},_applyEnabledState:function()
  7912. {this._selectElement.disabled=!this._enabled;},removeOption:function(option)
  7913. {this._selectElement.removeChild(option);},removeOptions:function()
  7914. {this._selectElement.removeChildren();},selectedOption:function()
  7915. {if(this._selectElement.selectedIndex>=0)
  7916. return this._selectElement[this._selectElement.selectedIndex];return null;},select:function(option)
  7917. {this._selectElement.selectedIndex=Array.prototype.indexOf.call((this._selectElement),option);},setSelectedIndex:function(index)
  7918. {this._selectElement.selectedIndex=index;},selectedIndex:function()
  7919. {return this._selectElement.selectedIndex;},__proto__:WebInspector.StatusBarItem.prototype}
  7920. WebInspector.StatusBarCheckbox=function(text,title,setting)
  7921. {WebInspector.StatusBarItem.call(this,createCheckboxLabel(text));this.element.classList.add("checkbox");this.inputElement=this.element.checkboxElement;if(title)
  7922. this.element.title=title;if(setting)
  7923. WebInspector.SettingsUI.bindCheckbox(this.inputElement,setting);}
  7924. WebInspector.StatusBarCheckbox.prototype={checked:function()
  7925. {return this.inputElement.checked;},__proto__:WebInspector.StatusBarItem.prototype}
  7926. WebInspector.StatusBarStatesSettingButton=function(className,states,titles,initialState,currentStateSetting,lastStateSetting,stateChangedCallback)
  7927. {WebInspector.StatusBarButton.call(this,"",className,states.length);var onClickBound=this._onClick.bind(this);this.addEventListener("click",onClickBound,this);this._states=states;this._buttons=[];for(var index=0;index<states.length;index++){var button=new WebInspector.StatusBarButton(titles[index],className,states.length);button.setState(this._states[index]);button.addEventListener("click",onClickBound,this);this._buttons.push(button);}
  7928. this._currentStateSetting=currentStateSetting;this._lastStateSetting=lastStateSetting;this._stateChangedCallback=stateChangedCallback;this.setLongClickOptionsEnabled(this._createOptions.bind(this));this._currentState=null;this._toggleState(initialState);}
  7929. WebInspector.StatusBarStatesSettingButton.prototype={_onClick:function(e)
  7930. {this._toggleState(e.target.state());},_toggleState:function(state)
  7931. {if(this._currentState===state)
  7932. return;if(this._currentState)
  7933. this._lastStateSetting.set(this._currentState);this._currentState=state;this._currentStateSetting.set(this._currentState);if(this._stateChangedCallback)
  7934. this._stateChangedCallback(state);var defaultState=this._defaultState();this.setState(defaultState);this.setTitle(this._buttons[this._states.indexOf(defaultState)].title());},toggle:function()
  7935. {this._toggleState(this.state());},_defaultState:function()
  7936. {var lastState=this._lastStateSetting.get();if(lastState&&this._states.indexOf(lastState)>=0&&lastState!=this._currentState)
  7937. return lastState;if(this._states.length>1&&this._currentState===this._states[0])
  7938. return this._states[1];return this._states[0];},_createOptions:function()
  7939. {var options=[];for(var index=0;index<this._states.length;index++){if(this._states[index]!==this.state()&&this._states[index]!==this._currentState)
  7940. options.push(this._buttons[index]);}
  7941. return options;},__proto__:WebInspector.StatusBarButton.prototype}
  7942. WebInspector.StatusBarItemWrapper=function(element)
  7943. {WebInspector.StatusBarItem.call(this,element,true);}
  7944. WebInspector.StatusBarItemWrapper.prototype={__proto__:WebInspector.StatusBarItem.prototype};WebInspector.SuggestBoxDelegate=function()
  7945. {}
  7946. WebInspector.SuggestBoxDelegate.prototype={applySuggestion:function(suggestion,isIntermediateSuggestion){},acceptSuggestion:function(){},}
  7947. WebInspector.SuggestBox=function(suggestBoxDelegate,maxItemsHeight)
  7948. {this._suggestBoxDelegate=suggestBoxDelegate;this._length=0;this._selectedIndex=-1;this._selectedElement=null;this._maxItemsHeight=maxItemsHeight;this._maybeHideBound=this._maybeHide.bind(this);this._element=createElementWithClass("div","suggest-box");this._element.addEventListener("mousedown",this._onBoxMouseDown.bind(this),true);}
  7949. WebInspector.SuggestBox.prototype={visible:function()
  7950. {return!!this._element.parentElement;},setPosition:function(anchorBox)
  7951. {this._updateBoxPosition(anchorBox);},_updateBoxPosition:function(anchorBox)
  7952. {console.assert(this._overlay);if(this._lastAnchorBox&&this._lastAnchorBox.equals(anchorBox))
  7953. return;this._lastAnchorBox=anchorBox;var container=WebInspector.Dialog.modalHostView().element;anchorBox=anchorBox.relativeToElement(container);var totalHeight=container.offsetHeight;var aboveHeight=anchorBox.y;var underHeight=totalHeight-anchorBox.y-anchorBox.height;this._overlay.setLeftOffset(anchorBox.x);var under=underHeight>=aboveHeight;if(under)
  7954. this._overlay.setVerticalOffset(anchorBox.y+anchorBox.height,true);else
  7955. this._overlay.setVerticalOffset(totalHeight-anchorBox.y,false);var rowHeight=17;var spacer=6;var maxHeight=this._maxItemsHeight?this._maxItemsHeight*rowHeight:Math.max(underHeight,aboveHeight)-spacer;this._element.style.maxHeight=maxHeight+"px";},_onBoxMouseDown:function(event)
  7956. {if(this._hideTimeoutId){window.clearTimeout(this._hideTimeoutId);delete this._hideTimeoutId;}
  7957. event.preventDefault();},_maybeHide:function()
  7958. {if(!this._hideTimeoutId)
  7959. this._hideTimeoutId=window.setTimeout(this.hide.bind(this),0);},_show:function()
  7960. {if(this.visible())
  7961. return;this._bodyElement=document.body;this._bodyElement.addEventListener("mousedown",this._maybeHideBound,true);this._overlay=new WebInspector.SuggestBox.Overlay();this._overlay.setContentElement(this._element);},hide:function()
  7962. {if(!this.visible())
  7963. return;this._bodyElement.removeEventListener("mousedown",this._maybeHideBound,true);delete this._bodyElement;this._element.remove();this._overlay.dispose();delete this._overlay;delete this._selectedElement;this._selectedIndex=-1;delete this._lastAnchorBox;},removeFromElement:function()
  7964. {this.hide();},_applySuggestion:function(isIntermediateSuggestion)
  7965. {if(!this.visible()||!this._selectedElement)
  7966. return false;var suggestion=this._selectedElement.textContent;if(!suggestion)
  7967. return false;this._suggestBoxDelegate.applySuggestion(suggestion,isIntermediateSuggestion);return true;},acceptSuggestion:function()
  7968. {var result=this._applySuggestion();this.hide();if(!result)
  7969. return false;this._suggestBoxDelegate.acceptSuggestion();return true;},_selectClosest:function(shift,isCircular)
  7970. {if(!this._length)
  7971. return false;if(this._selectedIndex===-1&&shift<0)
  7972. shift+=1;var index=this._selectedIndex+shift;if(isCircular)
  7973. index=(this._length+index)%this._length;else
  7974. index=Number.constrain(index,0,this._length-1);this._selectItem(index,true);this._applySuggestion(true);return true;},_onItemMouseDown:function(event)
  7975. {this._selectedElement=event.currentTarget;this.acceptSuggestion();event.consume(true);},_createItemElement:function(prefix,text)
  7976. {var element=createElementWithClass("div","suggest-box-content-item source-code");element.tabIndex=-1;if(prefix&&prefix.length&&!text.indexOf(prefix)){element.createChild("span","prefix").textContent=prefix;element.createChild("span","suffix").textContent=text.substring(prefix.length);}else{element.createChild("span","suffix").textContent=text;}
  7977. element.createChild("span","spacer");element.addEventListener("mousedown",this._onItemMouseDown.bind(this),false);return element;},_updateItems:function(items,userEnteredText)
  7978. {this._length=items.length;this._element.removeChildren();delete this._selectedElement;for(var i=0;i<items.length;++i){var item=items[i];var currentItemElement=this._createItemElement(userEnteredText,item);this._element.appendChild(currentItemElement);}},_selectItem:function(index,scrollIntoView)
  7979. {if(this._selectedElement)
  7980. this._selectedElement.classList.remove("selected");this._selectedIndex=index;if(index<0)
  7981. return;this._selectedElement=this._element.children[index];this._selectedElement.classList.add("selected");if(scrollIntoView)
  7982. this._selectedElement.scrollIntoViewIfNeeded(false);},_canShowBox:function(completions,canShowForSingleItem,userEnteredText)
  7983. {if(!completions||!completions.length)
  7984. return false;if(completions.length>1)
  7985. return true;return canShowForSingleItem&&completions[0]!==userEnteredText;},_ensureRowCountPerViewport:function()
  7986. {if(this._rowCountPerViewport)
  7987. return;if(!this._element.firstChild)
  7988. return;this._rowCountPerViewport=Math.floor(this._element.offsetHeight/this._element.firstChild.offsetHeight);},updateSuggestions:function(anchorBox,completions,selectedIndex,canShowForSingleItem,userEnteredText)
  7989. {if(this._canShowBox(completions,canShowForSingleItem,userEnteredText)){this._updateItems(completions,userEnteredText);this._show();this._updateBoxPosition(anchorBox);this._selectItem(selectedIndex,selectedIndex>0);delete this._rowCountPerViewport;}else
  7990. this.hide();},keyPressed:function(event)
  7991. {switch(event.keyIdentifier){case"Up":return this.upKeyPressed();case"Down":return this.downKeyPressed();case"PageUp":return this.pageUpKeyPressed();case"PageDown":return this.pageDownKeyPressed();case"Enter":return this.enterKeyPressed();}
  7992. return false;},upKeyPressed:function()
  7993. {return this._selectClosest(-1,true);},downKeyPressed:function()
  7994. {return this._selectClosest(1,true);},pageUpKeyPressed:function()
  7995. {this._ensureRowCountPerViewport();return this._selectClosest(-this._rowCountPerViewport,false);},pageDownKeyPressed:function()
  7996. {this._ensureRowCountPerViewport();return this._selectClosest(this._rowCountPerViewport,false);},enterKeyPressed:function()
  7997. {var hasSelectedItem=!!this._selectedElement;this.acceptSuggestion();return hasSelectedItem;}}
  7998. WebInspector.SuggestBox.Overlay=function()
  7999. {this.element=createElementWithClass("div","suggest-box-overlay");var root=this.element.createShadowRoot();root.appendChild(WebInspector.View.createStyleElement("ui/suggestBox.css"));this._leftSpacerElement=root.createChild("div","suggest-box-left-spacer");this._horizontalElement=root.createChild("div","suggest-box-horizontal");this._topSpacerElement=this._horizontalElement.createChild("div","suggest-box-top-spacer");this._bottomSpacerElement=this._horizontalElement.createChild("div","suggest-box-bottom-spacer");this._resize();document.body.appendChild(this.element);}
  8000. WebInspector.SuggestBox.Overlay.prototype={setLeftOffset:function(offset)
  8001. {this._leftSpacerElement.style.flexBasis=offset+"px";},setVerticalOffset:function(offset,isTopOffset)
  8002. {this.element.classList.toggle("under-anchor",isTopOffset);if(isTopOffset){this._bottomSpacerElement.style.flexBasis="auto";this._topSpacerElement.style.flexBasis=offset+"px";}else{this._bottomSpacerElement.style.flexBasis=offset+"px";this._topSpacerElement.style.flexBasis="auto";}},setContentElement:function(element)
  8003. {this._horizontalElement.insertBefore(element,this._bottomSpacerElement);},_resize:function()
  8004. {var container=WebInspector.Dialog.modalHostView().element;var containerBox=container.boxInWindow(container.ownerDocument.defaultView);this.element.style.left=containerBox.x+"px";this.element.style.top=containerBox.y+"px";this.element.style.height=containerBox.height+"px";this.element.style.width=containerBox.width+"px";},dispose:function()
  8005. {this.element.remove();}};WebInspector.TabbedPane=function()
  8006. {WebInspector.VBox.call(this,true);this.registerRequiredCSS("ui/tabbedPane.css");this.element.classList.add("tabbed-pane");this.contentElement.classList.add("tabbed-pane-shadow");this.contentElement.tabIndex=-1;this._headerElement=this.contentElement.createChild("div","tabbed-pane-header toolbar-colors");this._headerElement.createChild("content").select=".tabbed-pane-header-before";this._headerContentsElement=this._headerElement.createChild("div","tabbed-pane-header-contents");this._headerElement.createChild("content").select=".tabbed-pane-header-after";this._tabsElement=this._headerContentsElement.createChild("div","tabbed-pane-header-tabs");this._contentElement=this.contentElement.createChild("div","tabbed-pane-content");this._contentElement.createChild("content");this._tabs=[];this._tabsHistory=[];this._tabsById={};this._currentTabLocked=false;this._dropDownButton=this._createDropDownButton();WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged,this._zoomChanged,this);}
  8007. WebInspector.TabbedPane.EventTypes={TabSelected:"TabSelected",TabClosed:"TabClosed"}
  8008. WebInspector.TabbedPane.prototype={setCurrentTabLocked:function(locked)
  8009. {this._currentTabLocked=locked;this._headerElement.classList.toggle("locked",this._currentTabLocked);},get visibleView()
  8010. {return this._currentTab?this._currentTab.view:null;},tabViews:function()
  8011. {function tabToView(tab)
  8012. {return tab.view;}
  8013. return this._tabs.map(tabToView);},get selectedTabId()
  8014. {return this._currentTab?this._currentTab.id:null;},setShrinkableTabs:function(shrinkableTabs)
  8015. {this._shrinkableTabs=shrinkableTabs;},setVerticalTabLayout:function(verticalTabLayout)
  8016. {this._verticalTabLayout=verticalTabLayout;this.contentElement.classList.add("vertical-tab-layout");this.invalidateConstraints();},setCloseableTabs:function(closeableTabs)
  8017. {this._closeableTabs=closeableTabs;},setRetainTabOrder:function(retainTabOrder,tabOrderComparator)
  8018. {this._retainTabOrder=retainTabOrder;this._tabOrderComparator=tabOrderComparator;},defaultFocusedElement:function()
  8019. {return this.visibleView?this.visibleView.defaultFocusedElement():this.contentElement;},focus:function()
  8020. {if(this.visibleView)
  8021. this.visibleView.focus();else
  8022. this.contentElement.focus();},headerElement:function()
  8023. {return this._headerElement;},isTabCloseable:function(id)
  8024. {var tab=this._tabsById[id];return tab?tab.isCloseable():false;},setTabDelegate:function(delegate)
  8025. {var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i)
  8026. tabs[i].setDelegate(delegate);this._delegate=delegate;},appendTab:function(id,tabTitle,view,tabTooltip,userGesture,isCloseable)
  8027. {isCloseable=typeof isCloseable==="boolean"?isCloseable:this._closeableTabs;var tab=new WebInspector.TabbedPaneTab(this,id,tabTitle,isCloseable,view,tabTooltip);tab.setDelegate(this._delegate);this._tabsById[id]=tab;function comparator(tab1,tab2)
  8028. {return this._tabOrderComparator(tab1.id,tab2.id);}
  8029. if(this._tabOrderComparator)
  8030. this._tabs.splice(insertionIndexForObjectInListSortedByFunction(tab,this._tabs,comparator.bind(this)),0,tab);else
  8031. this._tabs.push(tab);this._tabsHistory.push(tab);if(this._tabsHistory[0]===tab&&this.isShowing())
  8032. this.selectTab(tab.id,userGesture);this._updateTabElements();},closeTab:function(id,userGesture)
  8033. {this.closeTabs([id],userGesture);},closeTabs:function(ids,userGesture)
  8034. {var focused=this.hasFocus();for(var i=0;i<ids.length;++i)
  8035. this._innerCloseTab(ids[i],userGesture);this._updateTabElements();if(this._tabsHistory.length)
  8036. this.selectTab(this._tabsHistory[0].id,false);if(focused)
  8037. this.focus();},_innerCloseTab:function(id,userGesture)
  8038. {if(!this._tabsById[id])
  8039. return;if(userGesture&&!this._tabsById[id]._closeable)
  8040. return;if(this._currentTab&&this._currentTab.id===id)
  8041. this._hideCurrentTab();var tab=this._tabsById[id];delete this._tabsById[id];this._tabsHistory.splice(this._tabsHistory.indexOf(tab),1);this._tabs.splice(this._tabs.indexOf(tab),1);if(tab._shown)
  8042. this._hideTabElement(tab);var eventData={tabId:id,view:tab.view,isUserGesture:userGesture};this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabClosed,eventData);return true;},hasTab:function(tabId)
  8043. {return!!this._tabsById[tabId];},allTabs:function()
  8044. {var result=[];var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i)
  8045. result.push(tabs[i].id);return result;},otherTabs:function(id)
  8046. {var result=[];var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i){if(tabs[i].id!==id)
  8047. result.push(tabs[i].id);}
  8048. return result;},selectTab:function(id,userGesture)
  8049. {if(this._currentTabLocked)
  8050. return false;var focused=this.hasFocus();var tab=this._tabsById[id];if(!tab)
  8051. return false;if(this._currentTab&&this._currentTab.id===id)
  8052. return true;this._hideCurrentTab();this._showTab(tab);this._currentTab=tab;this._tabsHistory.splice(this._tabsHistory.indexOf(tab),1);this._tabsHistory.splice(0,0,tab);this._updateTabElements();if(focused)
  8053. this.focus();var eventData={tabId:id,view:tab.view,isUserGesture:userGesture};this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabSelected,eventData);return true;},lastOpenedTabIds:function(tabsCount)
  8054. {function tabToTabId(tab){return tab.id;}
  8055. return this._tabsHistory.slice(0,tabsCount).map(tabToTabId);},setTabIcon:function(id,iconClass,iconTooltip)
  8056. {var tab=this._tabsById[id];if(tab._setIconClass(iconClass,iconTooltip))
  8057. this._updateTabElements();},toggleTabClass:function(id,className,force)
  8058. {var tab=this._tabsById[id];if(tab._toggleClass(className,force))
  8059. this._updateTabElements();},_zoomChanged:function(event)
  8060. {for(var i=0;i<this._tabs.length;++i)
  8061. delete this._tabs[i]._measuredWidth;if(this.isShowing())
  8062. this._updateTabElements();},changeTabTitle:function(id,tabTitle)
  8063. {var tab=this._tabsById[id];if(tab.title===tabTitle)
  8064. return;tab.title=tabTitle;this._updateTabElements();},changeTabView:function(id,view)
  8065. {var tab=this._tabsById[id];if(this._currentTab&&this._currentTab.id===tab.id){if(tab.view!==view)
  8066. this._hideTab(tab);tab.view=view;this._showTab(tab);}else
  8067. tab.view=view;},changeTabTooltip:function(id,tabTooltip)
  8068. {var tab=this._tabsById[id];tab.tooltip=tabTooltip;},onResize:function()
  8069. {this._updateTabElements();},headerResized:function()
  8070. {this._updateTabElements();},wasShown:function()
  8071. {var effectiveTab=this._currentTab||this._tabsHistory[0];if(effectiveTab)
  8072. this.selectTab(effectiveTab.id);},calculateConstraints:function()
  8073. {var constraints=WebInspector.VBox.prototype.calculateConstraints.call(this);var minContentConstraints=new Constraints(new Size(0,0),new Size(50,50));constraints=constraints.widthToMax(minContentConstraints).heightToMax(minContentConstraints);if(this._verticalTabLayout)
  8074. constraints=constraints.addWidth(new Constraints(new Size(this._headerElement.offsetWidth,0)));else
  8075. constraints=constraints.addHeight(new Constraints(new Size(0,this._headerElement.offsetHeight)));return constraints;},_updateTabElements:function()
  8076. {WebInspector.invokeOnceAfterBatchUpdate(this,this._innerUpdateTabElements);},setPlaceholderText:function(text)
  8077. {this._noTabsMessage=text;},_innerUpdateTabElements:function()
  8078. {if(!this.isShowing())
  8079. return;if(!this._tabs.length){this._contentElement.classList.add("has-no-tabs");if(this._noTabsMessage&&!this._noTabsMessageElement){this._noTabsMessageElement=this._contentElement.createChild("div","tabbed-pane-placeholder fill");this._noTabsMessageElement.textContent=this._noTabsMessage;}}else{this._contentElement.classList.remove("has-no-tabs");if(this._noTabsMessageElement){this._noTabsMessageElement.remove();delete this._noTabsMessageElement;}}
  8080. if(!this._measuredDropDownButtonWidth)
  8081. this._measureDropDownButton();this._updateWidths();this._updateTabsDropDown();},_showTabElement:function(index,tab)
  8082. {if(index>=this._tabsElement.children.length)
  8083. this._tabsElement.appendChild(tab.tabElement);else
  8084. this._tabsElement.insertBefore(tab.tabElement,this._tabsElement.children[index]);tab._shown=true;},_hideTabElement:function(tab)
  8085. {this._tabsElement.removeChild(tab.tabElement);tab._shown=false;},_createDropDownButton:function()
  8086. {var dropDownContainer=createElementWithClass("div","tabbed-pane-header-tabs-drop-down-container");dropDownContainer.createTextChild("\u00bb");this._dropDownMenu=new WebInspector.DropDownMenu(dropDownContainer);this._dropDownMenu.addEventListener(WebInspector.DropDownMenu.Events.ItemSelected,this._dropDownMenuItemSelected,this);return dropDownContainer;},_dropDownMenuItemSelected:function(event)
  8087. {var tabId=(event.data);this.selectTab(tabId,true);},_totalWidth:function()
  8088. {return this._headerContentsElement.getBoundingClientRect().width;},_updateTabsDropDown:function()
  8089. {var tabsToShowIndexes=this._tabsToShowIndexes(this._tabs,this._tabsHistory,this._totalWidth(),this._measuredDropDownButtonWidth);for(var i=0;i<this._tabs.length;++i){if(this._tabs[i]._shown&&tabsToShowIndexes.indexOf(i)===-1)
  8090. this._hideTabElement(this._tabs[i]);}
  8091. for(var i=0;i<tabsToShowIndexes.length;++i){var tab=this._tabs[tabsToShowIndexes[i]];if(!tab._shown)
  8092. this._showTabElement(i,tab);}
  8093. this._populateDropDownFromIndex();},_populateDropDownFromIndex:function()
  8094. {if(this._dropDownButton.parentElement)
  8095. this._headerContentsElement.removeChild(this._dropDownButton);this._dropDownMenu.clear();var tabsToShow=[];for(var i=0;i<this._tabs.length;++i){if(!this._tabs[i]._shown)
  8096. tabsToShow.push(this._tabs[i]);continue;}
  8097. function compareFunction(tab1,tab2)
  8098. {return tab1.title.localeCompare(tab2.title);}
  8099. if(!this._retainTabOrder)
  8100. tabsToShow.sort(compareFunction);var selectedId=null;for(var i=0;i<tabsToShow.length;++i){var tab=tabsToShow[i];this._dropDownMenu.addItem(tab.id,tab.title);if(this._tabsHistory[0]===tab)
  8101. selectedId=tab.id;}
  8102. if(tabsToShow.length){this._headerContentsElement.appendChild(this._dropDownButton);this._dropDownMenu.selectItem(selectedId);}},_measureDropDownButton:function()
  8103. {this._dropDownButton.classList.add("measuring");this._headerContentsElement.appendChild(this._dropDownButton);this._measuredDropDownButtonWidth=this._dropDownButton.getBoundingClientRect().width;this._headerContentsElement.removeChild(this._dropDownButton);this._dropDownButton.classList.remove("measuring");},_updateWidths:function()
  8104. {var measuredWidths=this._measureWidths();var maxWidth=this._shrinkableTabs?this._calculateMaxWidth(measuredWidths.slice(),this._totalWidth()):Number.MAX_VALUE;var i=0;for(var tabId in this._tabs){var tab=this._tabs[tabId];tab.setWidth(this._verticalTabLayout?-1:Math.min(maxWidth,measuredWidths[i++]));}},_measureWidths:function()
  8105. {this._tabsElement.style.setProperty("width","2000px");var measuringTabElements=[];for(var tabId in this._tabs){var tab=this._tabs[tabId];if(typeof tab._measuredWidth==="number")
  8106. continue;var measuringTabElement=tab._createTabElement(true);measuringTabElement.__tab=tab;measuringTabElements.push(measuringTabElement);this._tabsElement.appendChild(measuringTabElement);}
  8107. for(var i=0;i<measuringTabElements.length;++i){var width=measuringTabElements[i].getBoundingClientRect().width;measuringTabElements[i].__tab._measuredWidth=width;}
  8108. for(var i=0;i<measuringTabElements.length;++i)
  8109. measuringTabElements[i].remove();var measuredWidths=[];for(var tabId in this._tabs)
  8110. measuredWidths.push(this._tabs[tabId]._measuredWidth);this._tabsElement.style.removeProperty("width");return measuredWidths;},_calculateMaxWidth:function(measuredWidths,totalWidth)
  8111. {if(!measuredWidths.length)
  8112. return 0;measuredWidths.sort(function(x,y){return x-y;});var totalMeasuredWidth=0;for(var i=0;i<measuredWidths.length;++i)
  8113. totalMeasuredWidth+=measuredWidths[i];if(totalWidth>=totalMeasuredWidth)
  8114. return measuredWidths[measuredWidths.length-1];var totalExtraWidth=0;for(var i=measuredWidths.length-1;i>0;--i){var extraWidth=measuredWidths[i]-measuredWidths[i-1];totalExtraWidth+=(measuredWidths.length-i)*extraWidth;if(totalWidth+totalExtraWidth>=totalMeasuredWidth)
  8115. return measuredWidths[i-1]+(totalWidth+totalExtraWidth-totalMeasuredWidth)/(measuredWidths.length-i);}
  8116. return totalWidth/measuredWidths.length;},_tabsToShowIndexes:function(tabsOrdered,tabsHistory,totalWidth,measuredDropDownButtonWidth)
  8117. {var tabsToShowIndexes=[];var totalTabsWidth=0;var tabCount=tabsOrdered.length;for(var i=0;i<tabCount;++i){var tab=this._retainTabOrder?tabsOrdered[i]:tabsHistory[i];totalTabsWidth+=tab.width();var minimalRequiredWidth=totalTabsWidth;if(i!==tabCount-1)
  8118. minimalRequiredWidth+=measuredDropDownButtonWidth;if(!this._verticalTabLayout&&minimalRequiredWidth>totalWidth)
  8119. break;tabsToShowIndexes.push(tabsOrdered.indexOf(tab));}
  8120. tabsToShowIndexes.sort(function(x,y){return x-y;});return tabsToShowIndexes;},_hideCurrentTab:function()
  8121. {if(!this._currentTab)
  8122. return;this._hideTab(this._currentTab);delete this._currentTab;},_showTab:function(tab)
  8123. {tab.tabElement.classList.add("selected");tab.view.show(this.element);},_hideTab:function(tab)
  8124. {tab.tabElement.classList.remove("selected");tab.view.detach();},elementsToRestoreScrollPositionsFor:function()
  8125. {return[this._contentElement];},_insertBefore:function(tab,index)
  8126. {this._tabsElement.insertBefore(tab._tabElement||null,this._tabsElement.childNodes[index]);var oldIndex=this._tabs.indexOf(tab);this._tabs.splice(oldIndex,1);if(oldIndex<index)
  8127. --index;this._tabs.splice(index,0,tab);},insertBeforeTabStrip:function(element)
  8128. {element.classList.add("tabbed-pane-header-before");this.element.appendChild(element);},appendAfterTabStrip:function(element)
  8129. {element.classList.add("tabbed-pane-header-after");this.element.appendChild(element);},__proto__:WebInspector.VBox.prototype}
  8130. WebInspector.TabbedPaneTab=function(tabbedPane,id,title,closeable,view,tooltip)
  8131. {this._closeable=closeable;this._tabbedPane=tabbedPane;this._id=id;this._title=title;this._tooltip=tooltip;this._view=view;this._shown=false;this._measuredWidth;this._tabElement;}
  8132. WebInspector.TabbedPaneTab.prototype={get id()
  8133. {return this._id;},get title()
  8134. {return this._title;},set title(title)
  8135. {if(title===this._title)
  8136. return;this._title=title;if(this._titleElement)
  8137. this._titleElement.textContent=title;delete this._measuredWidth;},iconClass:function()
  8138. {return this._iconClass;},isCloseable:function()
  8139. {return this._closeable;},_setIconClass:function(iconClass,iconTooltip)
  8140. {if(iconClass===this._iconClass&&iconTooltip===this._iconTooltip)
  8141. return false;this._iconClass=iconClass;this._iconTooltip=iconTooltip;if(this._iconElement)
  8142. this._iconElement.remove();if(this._iconClass&&this._tabElement)
  8143. this._iconElement=this._createIconElement(this._tabElement,this._titleElement);delete this._measuredWidth;return true;},_toggleClass:function(className,force)
  8144. {var element=this.tabElement;var hasClass=element.classList.contains(className);if(hasClass===force)
  8145. return false;element.classList.toggle(className,force);delete this._measuredWidth;return true;},get view()
  8146. {return this._view;},set view(view)
  8147. {this._view=view;},get tooltip()
  8148. {return this._tooltip;},set tooltip(tooltip)
  8149. {this._tooltip=tooltip;if(this._titleElement)
  8150. this._titleElement.title=tooltip||"";},get tabElement()
  8151. {if(!this._tabElement)
  8152. this._tabElement=this._createTabElement(false);return this._tabElement;},width:function()
  8153. {return this._width;},setWidth:function(width)
  8154. {this.tabElement.style.width=width===-1?"":(width+"px");this._width=width;},setDelegate:function(delegate)
  8155. {this._delegate=delegate;},_createIconElement:function(tabElement,titleElement)
  8156. {var iconElement=createElementWithClass("span","tabbed-pane-header-tab-icon "+this._iconClass);if(this._iconTooltip)
  8157. iconElement.title=this._iconTooltip;tabElement.insertBefore(iconElement,titleElement);return iconElement;},_createTabElement:function(measuring)
  8158. {var tabElement=createElementWithClass("div","tabbed-pane-header-tab");tabElement.id="tab-"+this._id;tabElement.tabIndex=-1;tabElement.selectTabForTest=this._tabbedPane.selectTab.bind(this._tabbedPane,this.id,true);var titleElement=tabElement.createChild("span","tabbed-pane-header-tab-title");titleElement.textContent=this.title;titleElement.title=this.tooltip||"";if(this._iconClass)
  8159. this._createIconElement(tabElement,titleElement);if(!measuring)
  8160. this._titleElement=titleElement;if(this._closeable)
  8161. tabElement.createChild("div","tabbed-pane-close-button-gray");if(measuring){tabElement.classList.add("measuring");}else{tabElement.addEventListener("click",this._tabClicked.bind(this),false);tabElement.addEventListener("mousedown",this._tabMouseDown.bind(this),false);tabElement.addEventListener("mouseup",this._tabMouseUp.bind(this),false);if(this._closeable){tabElement.addEventListener("contextmenu",this._tabContextMenu.bind(this),false);WebInspector.installDragHandle(tabElement,this._startTabDragging.bind(this),this._tabDragging.bind(this),this._endTabDragging.bind(this),"pointer");}}
  8162. return tabElement;},_tabClicked:function(event)
  8163. {var middleButton=event.button===1;var shouldClose=this._closeable&&(middleButton||event.target.classList.contains("tabbed-pane-close-button-gray"));if(!shouldClose){this._tabbedPane.focus();return;}
  8164. this._closeTabs([this.id]);event.consume(true);},_tabMouseDown:function(event)
  8165. {if(event.target.classList.contains("tabbed-pane-close-button-gray")||event.button===1)
  8166. return;this._tabbedPane.selectTab(this.id,true);},_tabMouseUp:function(event)
  8167. {if(event.button===1)
  8168. event.consume(true);},_closeTabs:function(ids)
  8169. {if(this._delegate){this._delegate.closeTabs(this._tabbedPane,ids);return;}
  8170. this._tabbedPane.closeTabs(ids,true);},_tabContextMenu:function(event)
  8171. {function close()
  8172. {this._closeTabs([this.id]);}
  8173. function closeOthers()
  8174. {this._closeTabs(this._tabbedPane.otherTabs(this.id));}
  8175. function closeAll()
  8176. {this._closeTabs(this._tabbedPane.allTabs());}
  8177. var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString.capitalize("Close"),close.bind(this));contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^others"),closeOthers.bind(this));contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^all"),closeAll.bind(this));contextMenu.show();},_startTabDragging:function(event)
  8178. {if(event.target.classList.contains("tabbed-pane-close-button-gray"))
  8179. return false;this._dragStartX=event.pageX;return true;},_tabDragging:function(event)
  8180. {var tabElements=this._tabbedPane._tabsElement.childNodes;for(var i=0;i<tabElements.length;++i){var tabElement=tabElements[i];if(tabElement===this._tabElement)
  8181. continue;var intersects=tabElement.offsetLeft+tabElement.clientWidth>this._tabElement.offsetLeft&&this._tabElement.offsetLeft+this._tabElement.clientWidth>tabElement.offsetLeft;if(!intersects)
  8182. continue;if(Math.abs(event.pageX-this._dragStartX)<tabElement.clientWidth/2+5)
  8183. break;if(event.pageX-this._dragStartX>0){tabElement=tabElement.nextSibling;++i;}
  8184. var oldOffsetLeft=this._tabElement.offsetLeft;this._tabbedPane._insertBefore(this,i);this._dragStartX+=this._tabElement.offsetLeft-oldOffsetLeft;break;}
  8185. if(!this._tabElement.previousSibling&&event.pageX-this._dragStartX<0){this._tabElement.style.setProperty("left","0px");return;}
  8186. if(!this._tabElement.nextSibling&&event.pageX-this._dragStartX>0){this._tabElement.style.setProperty("left","0px");return;}
  8187. this._tabElement.style.setProperty("position","relative");this._tabElement.style.setProperty("left",(event.pageX-this._dragStartX)+"px");},_endTabDragging:function(event)
  8188. {this._tabElement.style.removeProperty("position");this._tabElement.style.removeProperty("left");delete this._dragStartX;}}
  8189. WebInspector.TabbedPaneTabDelegate=function()
  8190. {}
  8191. WebInspector.TabbedPaneTabDelegate.prototype={closeTabs:function(tabbedPane,ids){}}
  8192. WebInspector.ExtensibleTabbedPaneController=function(tabbedPane,extensionPoint,viewCallback)
  8193. {this._tabbedPane=tabbedPane;this._extensionPoint=extensionPoint;this._viewCallback=viewCallback;this._tabOrders={};this._promiseForId={};this._tabbedPane.setRetainTabOrder(true,this._tabOrderComparator.bind(this));this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);this._views=new Map();this._initialize();}
  8194. WebInspector.ExtensibleTabbedPaneController.prototype={_initialize:function()
  8195. {this._extensions=new Map();var extensions=self.runtime.extensions(this._extensionPoint);for(var i=0;i<extensions.length;++i){var descriptor=extensions[i].descriptor();var id=descriptor["name"];this._tabOrders[id]=i;var title=WebInspector.UIString(descriptor["title"]);var settingName=descriptor["setting"];var setting=settingName?(WebInspector.settings[settingName]):null;this._extensions.set(id,extensions[i]);if(setting){setting.addChangeListener(this._toggleSettingBasedView.bind(this,id,title,setting));if(setting.get())
  8196. this._tabbedPane.appendTab(id,title,new WebInspector.View());}else{this._tabbedPane.appendTab(id,title,new WebInspector.View());}}},_toggleSettingBasedView:function(id,title,setting)
  8197. {this._tabbedPane.closeTab(id);if(setting.get())
  8198. this._tabbedPane.appendTab(id,title,new WebInspector.View());},_tabSelected:function(event)
  8199. {var tabId=(event.data.tabId);this.viewForId(tabId).then(viewLoaded.bind(this));function viewLoaded(view)
  8200. {if(!view)
  8201. return;this._tabbedPane.changeTabView(tabId,view);var shouldFocus=this._tabbedPane.visibleView.element.isSelfOrAncestor(WebInspector.currentFocusElement());if(shouldFocus)
  8202. view.focus();}},viewIds:function()
  8203. {return this._extensions.keysArray();},viewForId:function(id)
  8204. {if(this._views.has(id))
  8205. return Promise.resolve((this._views.get(id)));if(!this._extensions.has(id))
  8206. return Promise.resolve((null));if(this._promiseForId[id])
  8207. return this._promiseForId[id];var promise=this._extensions.get(id).instancePromise();this._promiseForId[id]=(promise);return promise.then(cacheView.bind(this));function cacheView(object)
  8208. {var view=(object);delete this._promiseForId[id];this._views.set(id,view);if(this._viewCallback&&view)
  8209. this._viewCallback(id,view);return view;}},_tabOrderComparator:function(id1,id2)
  8210. {return this._tabOrders[id2]=this._tabOrders[id1];}};WebInspector.SidebarPane=function(title)
  8211. {WebInspector.View.call(this);this.setMinimumSize(25,0);this.element.className="sidebar-pane";this.titleElement=createElementWithClass("div","sidebar-pane-toolbar");this.bodyElement=this.element.createChild("div","body");this._title=title;this._expandCallback=null;}
  8212. WebInspector.SidebarPane.EventTypes={wasShown:"wasShown"}
  8213. WebInspector.SidebarPane.prototype={title:function()
  8214. {return this._title;},prepareContent:function(callback)
  8215. {if(callback)
  8216. callback();},expand:function()
  8217. {this.prepareContent(this.onContentReady.bind(this));},onContentReady:function()
  8218. {if(this._expandCallback)
  8219. this._expandCallback();else
  8220. this._expandPending=true;},setExpandCallback:function(callback)
  8221. {this._expandCallback=callback;if(this._expandPending){delete this._expandPending;this._expandCallback();}},wasShown:function()
  8222. {WebInspector.View.prototype.wasShown.call(this);this.dispatchEventToListeners(WebInspector.SidebarPane.EventTypes.wasShown);},__proto__:WebInspector.View.prototype}
  8223. WebInspector.SidebarPaneTitle=function(container,pane)
  8224. {this._pane=pane;this.element=container.createChild("div","sidebar-pane-title");this.element.textContent=pane.title();this.element.tabIndex=0;this.element.addEventListener("click",this._toggleExpanded.bind(this),false);this.element.addEventListener("keydown",this._onTitleKeyDown.bind(this),false);this.element.appendChild(this._pane.titleElement);this._pane.setExpandCallback(this._expand.bind(this));}
  8225. WebInspector.SidebarPaneTitle.prototype={_expand:function()
  8226. {this.element.classList.add("expanded");this._pane.show(this.element.parentElement,(this.element.nextSibling));},_collapse:function()
  8227. {this.element.classList.remove("expanded");if(this._pane.element.parentNode==this.element.parentNode)
  8228. this._pane.detach();},_toggleExpanded:function()
  8229. {if(this.element.classList.contains("expanded"))
  8230. this._collapse();else
  8231. this._pane.expand();},_onTitleKeyDown:function(event)
  8232. {if(isEnterKey(event)||event.keyCode===WebInspector.KeyboardShortcut.Keys.Space.code)
  8233. this._toggleExpanded();}}
  8234. WebInspector.SidebarPaneStack=function()
  8235. {WebInspector.View.call(this);this.setMinimumSize(25,0);this.element.className="sidebar-pane-stack";this._titleByPane=new Map();}
  8236. WebInspector.SidebarPaneStack.prototype={addPane:function(pane)
  8237. {this._titleByPane.set(pane,new WebInspector.SidebarPaneTitle(this.element,pane));},togglePaneHidden:function(pane,hide)
  8238. {var title=this._titleByPane.get(pane);if(!title)
  8239. return;title.element.classList.toggle("hidden",hide);pane.element.classList.toggle("hidden",hide);},__proto__:WebInspector.View.prototype}
  8240. WebInspector.SidebarTabbedPane=function()
  8241. {WebInspector.TabbedPane.call(this);this.setRetainTabOrder(true);this.element.classList.add("sidebar-tabbed-pane");}
  8242. WebInspector.SidebarTabbedPane.prototype={addPane:function(pane)
  8243. {var title=pane.title();this.appendTab(title,title,pane);pane.element.appendChild(pane.titleElement);pane.setExpandCallback(this.selectTab.bind(this,title));},__proto__:WebInspector.TabbedPane.prototype};WebInspector.TextEditor=function(){};WebInspector.TextEditor.Events={GutterClick:"gutterClick"};WebInspector.TextEditor.GutterClickEventData;WebInspector.TextEditor.prototype={undo:function(){},redo:function(){},isClean:function(){},markClean:function(){},indent:function(){},cursorPositionToCoordinates:function(lineNumber,column){return null;},coordinatesToCursorPosition:function(x,y){return null;},tokenAtTextPosition:function(lineNumber,column){return null;},setMimeType:function(mimeType){},setReadOnly:function(readOnly){},readOnly:function(){},defaultFocusedElement:function(){},highlightRange:function(range,cssClass){},removeHighlight:function(highlightDescriptor){},addBreakpoint:function(lineNumber,disabled,conditional){},removeBreakpoint:function(lineNumber){},setExecutionLine:function(lineNumber){},clearExecutionLine:function(){},toggleLineClass:function(lineNumber,className,toggled){},addDecoration:function(lineNumber,element){},removeDecoration:function(lineNumber,element){},highlightSearchResults:function(regex,range){},revealPosition:function(lineNumber,columnNumber,shouldHighlight){},clearPositionHighlight:function(){},elementsToRestoreScrollPositionsFor:function(){},inheritScrollPositions:function(textEditor){},beginUpdates:function(){},endUpdates:function(){},onResize:function(){},editRange:function(range,text){},scrollToLine:function(lineNumber){},firstVisibleLine:function(){},lastVisibleLine:function(){},selection:function(){},selections:function(){},lastSelection:function(){},setSelection:function(textRange){},copyRange:function(range){},setText:function(text){},text:function(){},range:function(){},line:function(lineNumber){},get linesCount(){},setAttribute:function(line,name,value){},getAttribute:function(line,name){},removeAttribute:function(line,name){},wasShown:function(){},willHide:function(){},setCompletionDictionary:function(dictionary){},textEditorPositionHandle:function(lineNumber,columnNumber){},dispose:function(){}}
  8244. WebInspector.TextEditorPositionHandle=function()
  8245. {}
  8246. WebInspector.TextEditorPositionHandle.prototype={resolve:function(){},equal:function(positionHandle){}}
  8247. WebInspector.TextEditorDelegate=function()
  8248. {}
  8249. WebInspector.TextEditorDelegate.prototype={onTextChanged:function(oldRange,newRange){},selectionChanged:function(textRange){},scrollChanged:function(lineNumber){},editorFocused:function(){},populateLineGutterContextMenu:function(contextMenu,lineNumber){},populateTextAreaContextMenu:function(contextMenu,lineNumber){},onJumpToPosition:function(from,to){}}
  8250. WebInspector.TokenizerFactory=function(){}
  8251. WebInspector.TokenizerFactory.prototype={createTokenizer:function(mimeType){}};WebInspector.TextPrompt=function(completions,stopCharacters)
  8252. {this._proxyElement;this._proxyElementDisplay="inline-block";this._loadCompletions=completions;this._completionStopCharacters=stopCharacters||" =:[({;,!+-*/&|^<>.";this._autocompletionTimeout=WebInspector.TextPrompt.DefaultAutocompletionTimeout;}
  8253. WebInspector.TextPrompt.DefaultAutocompletionTimeout=250;WebInspector.TextPrompt.Events={ItemApplied:"text-prompt-item-applied",ItemAccepted:"text-prompt-item-accepted"};WebInspector.TextPrompt.prototype={setAutocompletionTimeout:function(timeout)
  8254. {this._autocompletionTimeout=timeout;},get proxyElement()
  8255. {return this._proxyElement;},setSuggestBoxEnabled:function(suggestBoxEnabled)
  8256. {this._suggestBoxEnabled=suggestBoxEnabled;},renderAsBlock:function()
  8257. {this._proxyElementDisplay="block";},attach:function(element)
  8258. {return this._attachInternal(element);},attachAndStartEditing:function(element,blurListener)
  8259. {this._attachInternal(element);this._startEditing(blurListener);return this.proxyElement;},_attachInternal:function(element)
  8260. {if(this.proxyElement)
  8261. throw"Cannot attach an attached TextPrompt";this._element=element;this._boundOnKeyDown=this.onKeyDown.bind(this);this._boundOnInput=this.onInput.bind(this);this._boundOnMouseWheel=this.onMouseWheel.bind(this);this._boundSelectStart=this._selectStart.bind(this);this._boundRemoveSuggestionAids=this._removeSuggestionAids.bind(this);this._proxyElement=element.ownerDocument.createElement("span");this._proxyElement.style.display=this._proxyElementDisplay;element.parentElement.insertBefore(this.proxyElement,element);this.proxyElement.appendChild(element);this._element.classList.add("text-prompt");this._element.addEventListener("keydown",this._boundOnKeyDown,false);this._element.addEventListener("input",this._boundOnInput,false);this._element.addEventListener("mousewheel",this._boundOnMouseWheel,false);this._element.addEventListener("selectstart",this._boundSelectStart,false);this._element.addEventListener("blur",this._boundRemoveSuggestionAids,false);this._element.ownerDocument.defaultView.addEventListener("resize",this._boundRemoveSuggestionAids,false);if(this._suggestBoxEnabled)
  8262. this._suggestBox=new WebInspector.SuggestBox(this);return this.proxyElement;},detach:function()
  8263. {this._removeFromElement();this.proxyElement.parentElement.insertBefore(this._element,this.proxyElement);this.proxyElement.remove();delete this._proxyElement;this._element.classList.remove("text-prompt");WebInspector.restoreFocusFromElement(this._element);},get text()
  8264. {return this._element.textContent;},set text(x)
  8265. {this._removeSuggestionAids();if(!x){this._element.removeChildren();this._element.createChild("br");}else{this._element.textContent=x;}
  8266. this.moveCaretToEndOfPrompt();this._element.scrollIntoView();},_removeFromElement:function()
  8267. {this.clearAutoComplete(true);this._element.removeEventListener("keydown",this._boundOnKeyDown,false);this._element.removeEventListener("input",this._boundOnInput,false);this._element.removeEventListener("selectstart",this._boundSelectStart,false);this._element.removeEventListener("blur",this._boundRemoveSuggestionAids,false);this._element.ownerDocument.defaultView.removeEventListener("resize",this._boundRemoveSuggestionAids,false);if(this._isEditing)
  8268. this._stopEditing();if(this._suggestBox)
  8269. this._suggestBox.removeFromElement();},_startEditing:function(blurListener)
  8270. {this._isEditing=true;this._element.classList.add("editing");if(blurListener){this._blurListener=blurListener;this._element.addEventListener("blur",this._blurListener,false);}
  8271. this._oldTabIndex=this._element.tabIndex;if(this._element.tabIndex<0)
  8272. this._element.tabIndex=0;WebInspector.setCurrentFocusElement(this._element);if(!this.text)
  8273. this._updateAutoComplete();},_stopEditing:function()
  8274. {this._element.tabIndex=this._oldTabIndex;if(this._blurListener)
  8275. this._element.removeEventListener("blur",this._blurListener,false);this._element.classList.remove("editing");delete this._isEditing;},_removeSuggestionAids:function()
  8276. {this.clearAutoComplete();this.hideSuggestBox();},_selectStart:function()
  8277. {if(this._selectionTimeout)
  8278. clearTimeout(this._selectionTimeout);this._removeSuggestionAids();function moveBackIfOutside()
  8279. {delete this._selectionTimeout;if(!this.isCaretInsidePrompt()&&this._element.window().getSelection().isCollapsed){this.moveCaretToEndOfPrompt();this.autoCompleteSoon();}}
  8280. this._selectionTimeout=setTimeout(moveBackIfOutside.bind(this),100);},_updateAutoComplete:function(force)
  8281. {this.clearAutoComplete();this.autoCompleteSoon(force);},onMouseWheel:function(event)
  8282. {},onKeyDown:function(event)
  8283. {var handled=false;delete this._needUpdateAutocomplete;switch(event.keyIdentifier){case"U+0009":handled=this.tabKeyPressed(event);break;case"Left":case"Home":this._removeSuggestionAids();break;case"Right":case"End":if(this.isCaretAtEndOfPrompt())
  8284. handled=this.acceptAutoComplete();else
  8285. this._removeSuggestionAids();break;case"U+001B":if(this.isSuggestBoxVisible()){this._removeSuggestionAids();handled=true;}
  8286. break;case"U+0020":if(event.ctrlKey&&!event.metaKey&&!event.altKey&&!event.shiftKey){this._updateAutoComplete(true);handled=true;}
  8287. break;case"Alt":case"Meta":case"Shift":case"Control":break;}
  8288. if(!handled&&this.isSuggestBoxVisible())
  8289. handled=this._suggestBox.keyPressed(event);if(!handled)
  8290. this._needUpdateAutocomplete=true;if(handled)
  8291. event.consume(true);},onInput:function(event)
  8292. {if(this._needUpdateAutocomplete)
  8293. this._updateAutoComplete();},acceptAutoComplete:function()
  8294. {var result=false;if(this.isSuggestBoxVisible())
  8295. result=this._suggestBox.acceptSuggestion();if(!result)
  8296. result=this._acceptSuggestionInternal();return result;},clearAutoComplete:function(includeTimeout)
  8297. {if(includeTimeout&&this._completeTimeout){clearTimeout(this._completeTimeout);delete this._completeTimeout;}
  8298. delete this._waitingForCompletions;if(!this.autoCompleteElement)
  8299. return;this.autoCompleteElement.remove();delete this.autoCompleteElement;delete this._userEnteredRange;delete this._userEnteredText;},autoCompleteSoon:function(force)
  8300. {var immediately=this.isSuggestBoxVisible()||force;if(!this._completeTim